Просмотр исходного кода

기획전, 핫딜 조회 기간 쿼리 수정

eskim 4 лет назад
Родитель
Сommit
5fce9e7f2f

+ 10 - 6
src/main/java/com/style24/persistence/mybatis/shop/TsaPlan.xml

@@ -192,14 +192,18 @@
 		<if test="planGb != null and planGb != ''">
 		AND    PLAN_GB = #{planGb}
 		</if>
-		<if test="stDate != null and stDate != '' and edDate != null and edDate != ''">
-        AND    DISP_STDT <![CDATA[ >= ]]> DATE_FORMAT(#{stDate},'%Y-%m-%d %H:%i:%S')
-        AND    DISP_STDT <![CDATA[ <= ]]> DATE_FORMAT(#{edDate},'%Y-%m-%d %H:%i:%S')
+		<if test="stDate != null and stDate != ''">
+		AND    DISP_EDDT <![CDATA[ >= ]]> DATE_FORMAT(concat(#{stDate}, ' 00:00:00'),'%Y-%m-%d %H:%i:%S')
 		</if>
-		<if test="popupDispStdt != null and popupDispStdt != '' and popupDispEddt != null and popupDispEddt != ''">
-		AND    DISP_STDT <![CDATA[>=]]> DATE_FORMAT(#{popupDispStdt}, '%Y-%m-%d %H:%i:%S')
-		AND    DISP_STDT <![CDATA[<=]]> DATE_FORMAT(#{popupDispEddt}, '%Y-%m-%d %H:%i:%S')
+		<if test="edDate != null and edDate != ''">
+		AND    DISP_STDT <![CDATA[ <= ]]> DATE_FORMAT(concat(#{edDate}, ' 23:59:59') ,'%Y-%m-%d %H:%i:%S')
 		</if>
+		<if test="popupDispStdt != null and popupDispStdt != ''">
+		AND    DISP_EDDT <![CDATA[ >= ]]> DATE_FORMAT(concat(#{popupDispStdt}, ' 00:00:00'),'%Y-%m-%d %H:%i:%S')
+		</if>
+		<if test="popupDispEddt != null and popupDispEddt != ''">
+		AND    DISP_STDT <![CDATA[ <= ]]> DATE_FORMAT(concat(#{popupDispEddt}, ' 23:59:59') ,'%Y-%m-%d %H:%i:%S')
+		</if>	
 	</sql>
 	
 	<sql id="getListPagingCondition_sql">

+ 6 - 22
src/main/java/com/style24/persistence/mybatis/shop/TsaSocial.xml

@@ -251,28 +251,12 @@
 		<if test='frontGb != null and frontGb != "" and frontGb != "A"'>
 			AND (FRONT_GB = 'A' OR FRONT_GB = #{frontGb} )
 		</if>
-		<choose>
-			<when test="stDate != null and stDate != '' and edDate != null and edDate != ''">
-				AND    (
-				SOCIAL_EDDT <![CDATA[ >= ]]> DATE_FORMAT(#{stDate},'%Y-%m-%d %H:%i:%S')
-				AND
-				SOCIAL_STDT <![CDATA[ <= ]]> DATE_FORMAT(#{stDate},'%Y-%m-%d %H:%i:%S')
-				) OR
-				(
-				SOCIAL_EDDT <![CDATA[ >= ]]> DATE_FORMAT(#{edDate},'%Y-%m-%d %H:%i:%S')
-				AND
-				SOCIAL_STDT <![CDATA[ <= ]]> DATE_FORMAT(#{edDate},'%Y-%m-%d %H:%i:%S')
-				)
-			</when>
-			<when test="stDate != null and stDate != ''">
-			AND    SOCIAL_EDDT <![CDATA[ >= ]]> DATE_FORMAT(#{stDate},'%Y-%m-%d %H:%i:%S')
-			AND    SOCIAL_STDT <![CDATA[ <= ]]> DATE_FORMAT(#{stDate},'%Y-%m-%d %H:%i:%S')
-			</when>
-			<when test="edDate != null and edDate != ''">
-			AND    SOCIAL_EDDT <![CDATA[ >= ]]> DATE_FORMAT(#{edDate},'%Y-%m-%d %H:%i:%S')
-			AND    SOCIAL_STDT <![CDATA[ <= ]]> DATE_FORMAT(#{edDate},'%Y-%m-%d %H:%i:%S')
-			</when>
-		</choose>
+		<if test="stDate != null and stDate != ''">
+		AND    SOCIAL_EDDT <![CDATA[ >= ]]> DATE_FORMAT(concat(#{stDate}, ' 00:00:00'),'%Y-%m-%d %H:%i:%S')
+		</if>
+		<if test="edDate != null and edDate != ''">
+		AND    SOCIAL_STDT <![CDATA[ <= ]]> DATE_FORMAT(concat(#{edDate}, ' 23:59:59') ,'%Y-%m-%d %H:%i:%S')
+		</if>
 	</sql>
 
 	<sql id="getListPagingCondition_sql">