|
|
@@ -3928,61 +3928,94 @@
|
|
|
<!-- 사은품 목록 -->
|
|
|
<select id="getFreeGoodsList" parameterType="GoodsSearch" resultType="FreeGoods">
|
|
|
/* TsaGoods.getFreeGoodsList */
|
|
|
- SELECT G.PRODUCT_NO
|
|
|
- , G.PRODUCT_CODE
|
|
|
- , G.GOODS_NM
|
|
|
- , G.USE_YN
|
|
|
- , G.SYS_IMG_NM
|
|
|
- , G.BRAND_CD
|
|
|
- , B.BRAND_ENM
|
|
|
- , FN_GET_USER_NM(G.REG_NO) AS REG_NM
|
|
|
- , DATE_FORMAT(G.REG_DT,'%Y%m%d%H%i%S') AS REG_DT
|
|
|
- , FN_GET_USER_NM(G.UPD_NO) AS UPD_NM
|
|
|
- , DATE_FORMAT(G.UPD_DT,'%Y%m%d%H%i%S') AS UPD_DT
|
|
|
- FROM TB_FREE_GOODS G
|
|
|
- INNER JOIN TB_BRAND B ON G.BRAND_CD = B.BRAND_CD
|
|
|
- INNER JOIN TB_BRAND_SUPPLY BS ON G.BRAND_CD = BS.BRAND_CD
|
|
|
- WHERE 1 = 1
|
|
|
- <if test='conditionList != null and conditionList.length>0'>
|
|
|
- <choose>
|
|
|
- <when test='search != null and search == "searchProductNo"'>
|
|
|
- AND (
|
|
|
- <foreach collection="conditionList" item="item" index="index" separator="or">
|
|
|
- G.PRODUCT_NO = #{item}
|
|
|
- </foreach>
|
|
|
- )
|
|
|
- </when>
|
|
|
- <when test='search != null and search == "searchGoodsNm"'>
|
|
|
- AND (
|
|
|
- <foreach collection="conditionList" item="item" index="index" separator="or">
|
|
|
- UPPER(G.GOODS_NM) LIKE CONCAT(UPPER(#{item}),'%')
|
|
|
- </foreach>
|
|
|
- )
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- AND 1 = 1
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- <if test="supplyCompCd != null and supplyCompCd != ''">
|
|
|
- AND BS.SUPPLY_COMP_CD = #{supplyCompCd}
|
|
|
- </if>
|
|
|
- <if test="multiBrand != null and multiBrand != ''">
|
|
|
- AND B.BRAND_CD IN
|
|
|
- <foreach collection="multiBrand" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test='dateGbn != null and dateGbn == "R"'>
|
|
|
- <if test="stDate != null and stDate != ''">
|
|
|
- AND G.REG_DT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d %H:%i:%S')
|
|
|
- </if>
|
|
|
- <if test="edDate != null and edDate != ''">
|
|
|
- <![CDATA[
|
|
|
- AND G.REG_DT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
|
|
|
- ]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
+ SELECT G.* FROM (
|
|
|
+ SELECT G.PRODUCT_NO
|
|
|
+ , G.PRODUCT_CODE
|
|
|
+ , G.GOODS_NM
|
|
|
+ , G.USE_YN
|
|
|
+ , G.SYS_IMG_NM
|
|
|
+ , G.BRAND_CD
|
|
|
+ , B.BRAND_ENM
|
|
|
+ , FN_GET_USER_NM(G.REG_NO) AS REG_NM
|
|
|
+ , DATE_FORMAT(G.REG_DT,'%Y%m%d%H%i%S') AS REG_DT
|
|
|
+ , FN_GET_USER_NM(G.UPD_NO) AS UPD_NM
|
|
|
+ , DATE_FORMAT(G.UPD_DT,'%Y%m%d%H%i%S') AS UPD_DT
|
|
|
+ , (SELECT MAX(SKUCODE) FROM TB_IF_INCOMELOTITEM INC WHERE INC.PRODUCTNO = G.PRODUCT_NO ) AS SKUCODE
|
|
|
+ , (SELECT MAX(SKUMODELNO) FROM TB_IF_INCOMELOTITEM INC WHERE INC.PRODUCTNO = G.PRODUCT_NO ) AS SKUMODELNO
|
|
|
+ FROM TB_FREE_GOODS G
|
|
|
+ INNER JOIN TB_BRAND B ON G.BRAND_CD = B.BRAND_CD
|
|
|
+ INNER JOIN TB_BRAND_SUPPLY BS ON G.BRAND_CD = BS.BRAND_CD
|
|
|
+ WHERE 1 = 1
|
|
|
+ <if test='conditionList != null and conditionList.length>0'>
|
|
|
+ <choose>
|
|
|
+ <when test='search != null and search == "searchProductNo"'>
|
|
|
+ AND (
|
|
|
+ <foreach collection="conditionList" item="item" index="index" separator="or">
|
|
|
+ G.PRODUCT_NO = #{item}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <when test='search != null and search == "searchGoodsNm"'>
|
|
|
+ AND (
|
|
|
+ <foreach collection="conditionList" item="item" index="index" separator="or">
|
|
|
+ UPPER(G.GOODS_NM) LIKE CONCAT(UPPER(#{item}),'%')
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <when test='search != null and search == "searchProductCode"'>
|
|
|
+ AND (
|
|
|
+ <foreach collection="conditionList" item="item" index="index" separator="or">
|
|
|
+ UPPER(G.PRODUCT_CODE) LIKE CONCAT(UPPER(#{item}),'%')
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND 1 = 1
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="supplyCompCd != null and supplyCompCd != ''">
|
|
|
+ AND BS.SUPPLY_COMP_CD = #{supplyCompCd}
|
|
|
+ </if>
|
|
|
+ <if test="multiBrand != null and multiBrand != ''">
|
|
|
+ AND B.BRAND_CD IN
|
|
|
+ <foreach collection="multiBrand" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test='dateGbn != null and dateGbn == "R"'>
|
|
|
+ <if test="stDate != null and stDate != ''">
|
|
|
+ AND G.REG_DT >= DATE_FORMAT(#{stDate}, '%Y-%m-%d %H:%i:%S')
|
|
|
+ </if>
|
|
|
+ <if test="edDate != null and edDate != ''">
|
|
|
+ <![CDATA[
|
|
|
+ AND G.REG_DT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
|
|
|
+ ]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ ) G
|
|
|
+ WHERE 1=1
|
|
|
+ <if test='conditionList != null and conditionList.length>0'>
|
|
|
+ <choose>
|
|
|
+ <when test='search != null and search == "searchSkucode"'>
|
|
|
+ AND (
|
|
|
+ <foreach collection="conditionList" item="item" index="index" separator="or">
|
|
|
+ G.SKUCODE = #{item}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <when test='search != null and search == "searchSkumodelno"'>
|
|
|
+ AND (
|
|
|
+ <foreach collection="conditionList" item="item" index="index" separator="or">
|
|
|
+ UPPER(G.SKUMODELNO) LIKE CONCAT(UPPER(#{item}),'%')
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND 1 = 1
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
ORDER BY G.PRODUCT_NO DESC
|
|
|
</select>
|
|
|
|