전투시스템 중복 시간체크
전투시스템 이벤트 아이디 dynamodb 기준관리
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<id property="id" column="id"/>
|
||||
<result property="rowNum" column="row_num"/>
|
||||
<result property="groupId" column="group_id"/>
|
||||
<result property="eventId" column="event_id"/>
|
||||
<result property="eventName" column="event_name"/>
|
||||
<result property="repeatType" column="repeat_type"/>
|
||||
<result property="eventOperationTime" column="event_operation_time"/>
|
||||
@@ -32,6 +33,7 @@
|
||||
SELECT
|
||||
a.id
|
||||
, a.group_id
|
||||
, a.event_id
|
||||
, a.event_name
|
||||
, a.repeat_type
|
||||
, a.event_operation_time
|
||||
@@ -51,33 +53,35 @@
|
||||
WHERE 1 = 1
|
||||
|
||||
<choose>
|
||||
<when test="land_type == 'NAME' or land_type == 'name' ">
|
||||
<if test="land_data != null and land_data != ''">
|
||||
AND a.land_name LIKE CONCAT('%',#{land_data},'%')
|
||||
<when test="search_type == 'NAME' or search_type == 'name' ">
|
||||
<if test="search_data != null and search_data != ''">
|
||||
AND a.event_name LIKE CONCAT('%',#{search_data},'%')
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="land_data != null and land_data != ''">
|
||||
AND a.land_id = #{land_data}
|
||||
<if test="search_data != null and search_data != ''">
|
||||
AND a.event_id = #{search_data}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="user_type == 'NAME' or user_type == 'name' ">
|
||||
<if test="user_data != null and user_data != ''">
|
||||
AND a.bidder_nickname LIKE CONCAT('%',#{user_data},'%')
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="user_data != null and user_data != ''">
|
||||
AND a.bidder_guid = #{user_data}
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="land_size != null and land_size != ''">
|
||||
<if test="config_id != null and config_id != ''">
|
||||
<choose>
|
||||
<when test="land_size != 'ALL' ">
|
||||
AND a.land_size = #{land_size}
|
||||
<when test="config_id != 'ALL' ">
|
||||
AND a.config_id = #{config_id}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="reward_id != null and reward_id != ''">
|
||||
<choose>
|
||||
<when test="reward_id != 'ALL' ">
|
||||
AND a.reward_id = #{reward_id}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="repeat_type != null and repeat_type != ''">
|
||||
<choose>
|
||||
<when test="repeat_type != 'ALL' ">
|
||||
AND a.repeat_type = #{repeat_type}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
@@ -88,9 +92,23 @@
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="hot_time != null and hot_time != ''">
|
||||
<choose>
|
||||
<when test="hot_time != 'ALL' ">
|
||||
AND a.hot_time = #{hot_time}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="round_count != null and round_count != ''">
|
||||
<choose>
|
||||
<when test="round_count != 'ALL' ">
|
||||
AND a.round_count = #{round_count}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="start_dt != null and start_dt != '' and end_dt !=null and end_dt!= ''">
|
||||
AND a.auction_start_dt >= #{start_dt, jdbcType=TIMESTAMP}
|
||||
AND a.auction_end_dt <= #{end_dt, jdbcType=TIMESTAMP}
|
||||
AND a.event_start_dt >= #{start_dt, jdbcType=TIMESTAMP}
|
||||
AND a.event_end_dt <= #{end_dt, jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
GROUP BY a.id
|
||||
ORDER BY status
|
||||
@@ -137,19 +155,67 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getCheckBattleEventList" resultMap="BattleEventResultMap">
|
||||
SELECT id
|
||||
, event_id
|
||||
, repeat_type
|
||||
, event_operation_time
|
||||
, event_start_dt
|
||||
, event_end_dt
|
||||
FROM battle_event
|
||||
WHERE status NOT IN ('END', 'FAIL')
|
||||
AND (
|
||||
/* NONE 타입인 경우 */
|
||||
(repeat_type = 'NONE' AND DATE (event_start_dt) BETWEEN
|
||||
DATE (#{eventStartDt})
|
||||
AND DATE (#{eventEndDt}))
|
||||
OR
|
||||
/* DAY 타입인 경우 - 기간이 조금이라도 겹치면 가져옴 */
|
||||
(repeat_type = 'DAY'
|
||||
AND DATE (event_start_dt) <= DATE (#{eventEndDt})
|
||||
AND DATE (event_end_dt) >= DATE (#{eventStartDt}))
|
||||
OR
|
||||
/* 요일 타입인 경우 - 기간이 겹치고 같은 요일이 있는 경우만 */
|
||||
(repeat_type = #{repeatType}
|
||||
AND DATE (event_start_dt) <= DATE (#{eventEndDt})
|
||||
AND DATE (event_end_dt) >= DATE (#{eventStartDt})
|
||||
)
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="chkTimeOver" parameterType="com.caliverse.admin.domain.request.BattleEventRequest" resultType="integer">
|
||||
SELECT COUNT(*)
|
||||
FROM battle_event
|
||||
WHERE
|
||||
-- 시간 중복 체크
|
||||
TIME(#{eventStartTime}) < ADDTIME(TIME(event_start_dt), SEC_TO_TIME(event_operation_time))
|
||||
AND ADDTIME(TIME(#{eventStartTime}), SEC_TO_TIME(#{eventOperationTime})) > TIME(event_start_dt)
|
||||
-- 날짜 범위 중복 체크
|
||||
WHERE status = 'REGISTER'
|
||||
AND (
|
||||
(DATE(#{eventStartTime}) BETWEEN DATE(event_start_dt) AND DATE(event_end_dt))
|
||||
OR (DATE(#{eventEndTime}) BETWEEN DATE(event_start_dt) AND DATE(event_end_dt))
|
||||
OR (DATE(event_start_dt) BETWEEN DATE(#{eventStartTime}) AND DATE(#{eventEndTime}))
|
||||
OR (DATE(event_end_dt) BETWEEN DATE(#{eventStartTime}) AND DATE(#{eventEndTime}))
|
||||
/* 실행 날짜 체크 */
|
||||
CASE
|
||||
/* 기존 데이터가 NONE 타입일 때 */
|
||||
WHEN type = 'NONE' THEN
|
||||
DATE(event_start_dt) = DATE(#{eventStartDt})
|
||||
|
||||
/* 기존 데이터가 DAY 타입일 때 */
|
||||
WHEN type = 'DAY' THEN
|
||||
DATE(event_start_dt) <= DATE(#{eventStartDt}) AND
|
||||
DATE(event_end_dt) >= DATE(#{eventStartDt})
|
||||
|
||||
/* 기존 데이터가 요일 타입일 때 */
|
||||
WHEN type IN ('SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY') THEN
|
||||
DATE(event_start_dt) <= DATE(#{eventStartDt}) AND
|
||||
DATE(event_end_dt) >= DATE(#{eventStartDt}) AND
|
||||
DAYOFWEEK(event_start_dt) = DAYOFWEEK(#{eventStartDt})
|
||||
END
|
||||
)
|
||||
/* 시간 겹침 체크 */
|
||||
AND (
|
||||
TIME(event_start_dt) <= TIME(#{eventStartDt})
|
||||
AND TIME(DATE_ADD(event_start_dt, INTERVAL event_operation_time SECOND)) > TIME(#{eventStartDt})
|
||||
OR
|
||||
TIME(event_start_dt) < TIME(DATE_ADD(#{eventStartDt}, INTERVAL #{event_operation_time} SECOND))
|
||||
AND TIME(DATE_ADD(event_start_dt, INTERVAL event_operation_time SECOND)) >= TIME(DATE_ADD(#{eventStartDt}, INTERVAL #{eventOperationTime} SECOND))
|
||||
OR
|
||||
TIME(event_start_dt) >= TIME(#{eventStartDt})
|
||||
AND TIME(DATE_ADD(event_start_dt, INTERVAL event_operation_time SECOND)) <= TIME(DATE_ADD(#{eventStartDt}, INTERVAL #{eventOperationTime} SECOND))
|
||||
)
|
||||
</select>
|
||||
|
||||
@@ -158,6 +224,7 @@
|
||||
SELECT
|
||||
a.id
|
||||
, a.group_id
|
||||
, a.event_id
|
||||
, a.event_name
|
||||
, a.repeat_type
|
||||
, a.event_operation_time
|
||||
@@ -179,8 +246,8 @@
|
||||
|
||||
<!--저장-->
|
||||
<insert id="postBattleEvent" parameterType="com.caliverse.admin.domain.request.BattleEventRequest" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO battle_event (group_id, event_name, repeat_type, event_operation_time, event_start_dt, event_end_dt, config_id, reward_group_id, round_time, round_count, hot_time, instance_id, create_by, update_by)
|
||||
VALUES (#{groupId}, #{eventName}, #{repeatType}, #{eventOperationTime}, #{eventStartDt}, #{eventEndDt}, #{configId}, #{rewardGroupId}, #{roundTime}, #{roundCount}, #{hotTime}, #{instanceId} #{createBy}, #{updateBy})
|
||||
INSERT INTO battle_event (group_id, event_id, event_name, repeat_type, event_operation_time, event_start_dt, event_end_dt, config_id, reward_group_id, round_time, round_count, hot_time, instance_id, create_by, update_by)
|
||||
VALUES (#{groupId}, #{eventId}, #{eventName}, #{repeatType}, #{eventOperationTime}, #{eventStartDt}, #{eventEndDt}, #{configId}, #{rewardGroupId}, #{roundTime}, #{roundCount}, #{hotTime}, #{instanceId}, #{createBy}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
<!--수정-->
|
||||
@@ -215,6 +282,7 @@
|
||||
<select id="getScheduleBattleEventList" resultMap="BattleEventResultMap">
|
||||
SELECT id
|
||||
, a.group
|
||||
, a.event_id
|
||||
, a.event_name
|
||||
, a.repeat_type
|
||||
, a.event_operation_time
|
||||
|
||||
Reference in New Issue
Block a user