|
@@ -5398,7 +5398,7 @@
|
|
|
<!-- 최초주문상세번호 기준 상품쿠폰 할인액 조회 -->
|
|
<!-- 최초주문상세번호 기준 상품쿠폰 할인액 조회 -->
|
|
|
<select id="getGoodsCpnDcAmt" parameterType="Order" resultType="int">
|
|
<select id="getGoodsCpnDcAmt" parameterType="Order" resultType="int">
|
|
|
/* TscOrderChange.getGoodsCpnDcAmt */
|
|
/* TscOrderChange.getGoodsCpnDcAmt */
|
|
|
- SELECT SUM(GOODS_CPN_DC_AMT) AS GOODS_CPN_DC_AMT
|
|
|
|
|
|
|
+ SELECT IFNULL(SUM(GOODS_CPN_DC_AMT), 0) AS GOODS_CPN_DC_AMT
|
|
|
FROM TB_ORDER_DETAIL
|
|
FROM TB_ORDER_DETAIL
|
|
|
WHERE FIRST_ORD_DTL_NO = #{firstOrdDtlNo}
|
|
WHERE FIRST_ORD_DTL_NO = #{firstOrdDtlNo}
|
|
|
</select>
|
|
</select>
|
|
@@ -5453,6 +5453,228 @@
|
|
|
ON OD.ORD_DTL_NO = OCD.ORD_DTL_NO
|
|
ON OD.ORD_DTL_NO = OCD.ORD_DTL_NO
|
|
|
WHERE OD.ORD_NO = #{ordNo}
|
|
WHERE OD.ORD_NO = #{ordNo}
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 현금환불정보 생성 -->
|
|
|
|
|
+ <insert id="createCashRefund" parameterType="OrderChange">
|
|
|
|
|
+ /* TscOrderChange.createCashRefund */
|
|
|
|
|
+ INSERT INTO TB_CASH_REFUND (
|
|
|
|
|
+ ORD_NO
|
|
|
|
|
+ , ORD_CHG_SQ
|
|
|
|
|
+ , DEPOSIT_AMT
|
|
|
|
|
+ , CASH_REFUND_REASON
|
|
|
|
|
+ , BANK_CD
|
|
|
|
|
+ , ACCOUNT_NO
|
|
|
|
|
+ , ACCOUNT_NM
|
|
|
|
|
+ , DEPOSIT_YN
|
|
|
|
|
+ , DEPOSIT_DT
|
|
|
|
|
+ , REG_NO
|
|
|
|
|
+ , REG_DT
|
|
|
|
|
+ , UPD_NO
|
|
|
|
|
+ , UPD_DT
|
|
|
|
|
+ ) VALUES (
|
|
|
|
|
+ #{ordNo}
|
|
|
|
|
+ , #{ordChgSq}
|
|
|
|
|
+ , #{depositAmt}
|
|
|
|
|
+ , #{cashRefundReason}
|
|
|
|
|
+ , #{bankCd}
|
|
|
|
|
+ , #{accountNo}
|
|
|
|
|
+ , #{accountNm}
|
|
|
|
|
+ , #{depositYn}
|
|
|
|
|
+ , #{depositDt}
|
|
|
|
|
+ , #{regNo}
|
|
|
|
|
+ , NOW()
|
|
|
|
|
+ , #{updNo}
|
|
|
|
|
+ , NOW()
|
|
|
|
|
+ )
|
|
|
|
|
+ </insert>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 현금환불내역수 조회 -->
|
|
|
|
|
+ <select id="getCashRefundListCount" parameterType="OrderChange" resultType="int">
|
|
|
|
|
+ /* TscOrderChange.getCashRefundListCount */
|
|
|
|
|
+ SELECT COUNT(*)
|
|
|
|
|
+ FROM TB_CASH_REFUND CR
|
|
|
|
|
+ INNER JOIN TB_ORDER O
|
|
|
|
|
+ ON CR.ORD_NO = O.ORD_NO
|
|
|
|
|
+ INNER JOIN TB_CUSTOMER C
|
|
|
|
|
+ ON O.CUST_NO = C.CUST_NO
|
|
|
|
|
+ INNER JOIN TB_PAYMENT P
|
|
|
|
|
+ ON CR.ORD_NO = P.ORD_NO
|
|
|
|
|
+ AND P.PAY_STAT IN ('G016_10', 'G016_30')
|
|
|
|
|
+ AND P.PAY_GB = 'O'
|
|
|
|
|
+ INNER JOIN TB_ORDER_CHANGE OC
|
|
|
|
|
+ ON CR.ORD_CHG_SQ = OC.ORD_CHG_SQ
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ <if test="searchGb == 'ordNm' and searchTxt != null and searchTxt != ''">
|
|
|
|
|
+ AND O.ORD_NM = #{searchTxt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="searchGb == 'custId' and searchTxt != null and searchTxt != ''">
|
|
|
|
|
+ AND O.ORD_NM = #{searchTxt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="searchGb == 'ordPhnno' and searchTxt != null and searchTxt != ''">
|
|
|
|
|
+ AND O.ORD_NM = #{searchTxt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="depositYn != null and depositYn != ''">
|
|
|
|
|
+ AND CR.DEPOSIT_YN = #{depositYn}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="conditions != null and conditions.length > 0">
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="search == 'searchOrdNo'">
|
|
|
|
|
+ AND CR.ORD_NO IN
|
|
|
|
|
+ <foreach collection="conditions" item="item" index="index" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="search == 'searchOrdChgSq'">
|
|
|
|
|
+ AND CR.ORD_CHG_SQ IN
|
|
|
|
|
+ <foreach collection="conditions" item="item" index="index" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="accountNo != null and accountNo != ''">
|
|
|
|
|
+ AND CR.ACCOUNT_NO = #{accountNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="bankCd != null and bankCd != ''">
|
|
|
|
|
+ AND CR.BANK_CD = #{bankCd}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="stDate != null and stDate != '' and edDate != null and edDate != ''">
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="searchDateGb == 'regDt'">
|
|
|
|
|
+ AND CR.REG_DT BETWEEN CONCAT(#{stDate}, ' 00:00:00') AND CONCAT(#{edDate}, ' 23:59:59')
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="searchDateGb == 'depositDt'">
|
|
|
|
|
+ AND CR.DEPOSIT_DT BETWEEN CONCAT(#{stDate}, ' 00:00:00') AND CONCAT(#{edDate}, ' 23:59:59')
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 현금환불내역 조회 -->
|
|
|
|
|
+ <select id="getCashRefundList" parameterType="OrderChange" resultType="OrderChange">
|
|
|
|
|
+ /* TscOrderChange.getCashRefundList */
|
|
|
|
|
+ SELECT CR.CASH_REFUND_SQ
|
|
|
|
|
+ , CR.DEPOSIT_YN
|
|
|
|
|
+ , CR.DEPOSIT_YN AS ORG_DEPOSIT_YN
|
|
|
|
|
+ , (SELECT CHG_STAT
|
|
|
|
|
+ FROM TB_ORDER_CHANGE_DETAIL
|
|
|
|
|
+ WHERE ORD_CHG_SQ = CR.ORD_CHG_SQ
|
|
|
|
|
+ LIMIT 1) AS CHG_STAT
|
|
|
|
|
+ , FN_GET_CODE_NM('G685', (SELECT CHG_STAT
|
|
|
|
|
+ FROM TB_ORDER_CHANGE_DETAIL
|
|
|
|
|
+ WHERE ORD_CHG_SQ = CR.ORD_CHG_SQ
|
|
|
|
|
+ LIMIT 1)) AS CHG_STAT_NM
|
|
|
|
|
+ , OC.REG_DT AS CLAIM_DT
|
|
|
|
|
+ , CR.ORD_NO
|
|
|
|
|
+ , CR.ORD_CHG_SQ
|
|
|
|
|
+ , CONCAT(O.ORD_NM, '(', C.CUST_ID, ')') AS ORD_NM
|
|
|
|
|
+ , O.ORD_NM
|
|
|
|
|
+ , O.ORD_PHNNO
|
|
|
|
|
+ , CR.DEPOSIT_AMT
|
|
|
|
|
+ , P.PAY_MEANS
|
|
|
|
|
+ , FN_GET_CODE_NM('G014', P.PAY_MEANS) AS PAY_MEANS_NM
|
|
|
|
|
+ , CR.BANK_CD
|
|
|
|
|
+ , CR.ACCOUNT_NO
|
|
|
|
|
+ , CR.ACCOUNT_NM
|
|
|
|
|
+ , OC.CHG_MEMO
|
|
|
|
|
+ , CR.REG_DT
|
|
|
|
|
+ , CR.DEPOSIT_DT
|
|
|
|
|
+ FROM TB_CASH_REFUND CR
|
|
|
|
|
+ INNER JOIN TB_ORDER O
|
|
|
|
|
+ ON CR.ORD_NO = O.ORD_NO
|
|
|
|
|
+ INNER JOIN TB_CUSTOMER C
|
|
|
|
|
+ ON O.CUST_NO = C.CUST_NO
|
|
|
|
|
+ INNER JOIN TB_PAYMENT P
|
|
|
|
|
+ ON CR.ORD_NO = P.ORD_NO
|
|
|
|
|
+ AND P.PAY_STAT IN ('G016_10', 'G016_30')
|
|
|
|
|
+ AND P.PAY_GB = 'O'
|
|
|
|
|
+ INNER JOIN TB_ORDER_CHANGE OC
|
|
|
|
|
+ ON CR.ORD_CHG_SQ = OC.ORD_CHG_SQ
|
|
|
|
|
+ WHERE 1=1
|
|
|
|
|
+ <if test="searchGb == 'ordNm' and searchTxt != null and searchTxt != ''">
|
|
|
|
|
+ AND O.ORD_NM = #{searchTxt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="searchGb == 'custId' and searchTxt != null and searchTxt != ''">
|
|
|
|
|
+ AND C.CUST_ID = #{searchTxt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="searchGb == 'ordPhnno' and searchTxt != null and searchTxt != ''">
|
|
|
|
|
+ AND O.ORD_PHNNO = #{searchTxt}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="depositYn != null and depositYn != ''">
|
|
|
|
|
+ AND CR.DEPOSIT_YN = #{depositYn}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="conditions != null and conditions.length > 0">
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="search == 'searchOrdNo'">
|
|
|
|
|
+ AND CR.ORD_NO IN
|
|
|
|
|
+ <foreach collection="conditions" item="item" index="index" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="search == 'searchOrdChgSq'">
|
|
|
|
|
+ AND CR.ORD_CHG_SQ IN
|
|
|
|
|
+ <foreach collection="conditions" item="item" index="index" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="accountNo != null and accountNo != ''">
|
|
|
|
|
+ AND CR.ACCOUNT_NO = #{accountNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="bankCd != null and bankCd != ''">
|
|
|
|
|
+ AND CR.BANK_CD = #{bankCd}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="stDate != null and stDate != '' and edDate != null and edDate != ''">
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="searchDateGb == 'regDt'">
|
|
|
|
|
+ AND CR.REG_DT BETWEEN CONCAT(#{stDate}, ' 00:00:00') AND CONCAT(#{edDate}, ' 23:59:59')
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <when test="searchDateGb == 'depositDt'">
|
|
|
|
|
+ AND CR.DEPOSIT_DT BETWEEN CONCAT(#{stDate}, ' 00:00:00') AND CONCAT(#{edDate}, ' 23:59:59')
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ORDER BY CR.CASH_REFUND_SQ DESC
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 현금환불정보 수정 -->
|
|
|
|
|
+ <update id="updateCashRefundInfo" parameterType="OrderChange">
|
|
|
|
|
+ /* TscOrderChange.updateCashRefundInfo */
|
|
|
|
|
+ UPDATE TB_CASH_REFUND
|
|
|
|
|
+ SET DEPOSIT_YN = #{depositYn}
|
|
|
|
|
+ <if test='depositYn == "Y"'>
|
|
|
|
|
+ , DEPOSIT_DT = NOW()
|
|
|
|
|
+ </if>
|
|
|
|
|
+ , BANK_CD = #{bankCd}
|
|
|
|
|
+ , ACCOUNT_NO = #{accountNo}
|
|
|
|
|
+ , ACCOUNT_NM = #{accountNm}
|
|
|
|
|
+ , UPD_NO = #{updNo}
|
|
|
|
|
+ , UPD_DT = NOW()
|
|
|
|
|
+ WHERE CASH_REFUND_SQ = #{cashRefundSq}
|
|
|
|
|
+ </update>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 현금환불관리 CS메모 수정 -->
|
|
|
|
|
+ <update id="updateCsMemo" parameterType="OrderChange">
|
|
|
|
|
+ /* TscOrderChange.updateCsMemo */
|
|
|
|
|
+ UPDATE TB_ORDER_CHANGE
|
|
|
|
|
+ SET CHG_MEMO = #{chgMemo}
|
|
|
|
|
+ , UPD_NO = #{updNo}
|
|
|
|
|
+ , UPD_DT = NOW()
|
|
|
|
|
+ WHERE ORD_CHG_SQ = #{ordChgSq}
|
|
|
|
|
+ </update>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 현금환불 입금 완료 처리 -->
|
|
|
|
|
+ <update id="completeCashRefund" parameterType="OrderChange">
|
|
|
|
|
+ /* TscOrderChange.completeCashRefund */
|
|
|
|
|
+ UPDATE TB_CASH_REFUND
|
|
|
|
|
+ SET DEPOSIT_YN = 'Y'
|
|
|
|
|
+ , DEPOSIT_DT = NOW()
|
|
|
|
|
+ , UPD_NO = #{updNo}
|
|
|
|
|
+ , UPD_DT = NOW()
|
|
|
|
|
+ WHERE CASH_REFUND_SQ = #{cashRefundSq}
|
|
|
|
|
+ AND DEPOSIT_YN = 'N'
|
|
|
|
|
+ </update>
|
|
|
</mapper>
|
|
</mapper>
|
|
|
|
|
|
|
|
|
|
|