<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.style24.admin.biz.dao.TsaMarketingDao">

	<!-- 품목 목록 -->
	<select id="getFreeGoodsPromotionList" parameterType="Marketing" resultType="Marketing">
		/* TsaMarketing.getFreeGoodsPromotionList */
		SELECT FG.FREEGIFT_SQ
		     , FG.FREEGIFT_NM
		     , FG.FREEGIFT_STAT
		     , DATE_FORMAT(FG.FREEGIFT_STDT, '%Y.%m.%d') AS FREEGIFT_STDT
		     , DATE_FORMAT(FG.FREEGIFT_EDDT, '%Y.%m.%d') AS FREEGIFT_EDDT
		     , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.REG_NO) AS REG_NM
		     , DATE_FORMAT(FG.REG_DT, '%Y.%m.%d %H:%i:%S') AS REG_DT
		     , (SELECT USER_NM FROM TB_USER WHERE USER_NO = FG.UPD_NO) AS UPD_NM
		     , DATE_FORMAT(FG.UPD_DT, '%Y.%m.%d %H:%i:%S') AS UPD_DT
          FROM TB_FREEGIFT FG
         WHERE 1=1
		<if test="searchTxt != null and searchTxt != ''">
			<if test="promotionGubun != null and promotionGubun == 'freeGiftSq'">
				AND FG.FREEGIFT_SQ = #{searchTxt}
			</if>
			<if test="promotionGubun != null and promotionGubun == 'freeGiftName'">
				AND FG.FREEGIFT_NAME = #{searchTxt}
			</if>
		</if>
         ORDER BY REG_DT DESC
	</select>

	<!-- xodud1202 진행 -->

	<!-- // xodud1202 진행 -->

	<!-- JSM 진행 -->

	<!-- // JSM 진행 -->
</mapper>