|
@@ -5,39 +5,66 @@
|
5
|
5
|
|
6
|
6
|
<select id="selectUnpaidMngGridList" resultType="com.oqpo.api.entity.settmng.StlMgntBaseInfoEntity">
|
7
|
7
|
/* UnpaidMngMapper.selectUnpaidMngGridList */
|
8
|
|
- SELECT A.sttl_mgnt_unq_no,
|
9
|
|
- A.store_id, FN_STORE_NM(A.brand_id, A.store_id) AS store_nm,
|
10
|
|
- A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
|
11
|
|
- A.sttl_st_cd, FN_CODE_NM('STTL_ST_CD', A.sttl_st_cd) AS sttl_st_nm,
|
12
|
|
- DATE_FORMAT(A.sttl_req_dt, '%Y.%m.%d') AS sttl_req_dt,
|
13
|
|
- A.sttl_req_amt, A.sttl_amt,
|
14
|
|
- A.sttl_req_amt - IFNULL(A.sttl_amt, 0) AS acct_bal,
|
15
|
|
- C.loan_dvsn, FN_CODE_NM('LOAN_DVSN', C.loan_dvsn) AS loan_dvsn_nm /* 정산타입 */
|
16
|
|
- FROM stl_mgnt_base_info A
|
17
|
|
- INNER JOIN store_base_info B ON A.brand_id = B.brand_id AND A.store_id = B.store_id
|
18
|
|
- INNER JOIN loan_mgnt_base_info C ON B.loan_mgnt_unq_no = C.loan_mgnt_unq_no
|
|
8
|
+ SELECT store.store_id, store.store_nm, store.brand_id, FN_BRAND_NM(store.brand_id) AS brand_nm,
|
|
9
|
+ store.sttl_req_cfrm_term, /* 정산요청확인기간 */
|
|
10
|
+ store.sttl_rcp_amt_term, /* 정산대금입금기간 */
|
|
11
|
+ loan.loan_mgnt_unq_no, /* 여신관리고유번호 */
|
|
12
|
+ loan.loan_dvsn, FN_CODE_NM('LOAN_DVSN', loan.loan_dvsn) AS loan_dvsn_nm, /* 여신구분(정산타입) */
|
|
13
|
+ loan.credt_limit_amt - loan.use_amt_total + loan.acct_bal + loan.tmp_rcv_acct_total AS use_amt_total, /* 사용가능한도 */
|
|
14
|
+ loan.acct_bal, /* 계좌잔액 */
|
|
15
|
+ loan.credt_limit_amt, /* 신용한도금액(후불) */
|
|
16
|
+ loan.tmp_rcv_acct_total, /* 가수금액합계(선결제) */
|
|
17
|
+ stl.sttl_req_dt, /* 정산요청일자 */
|
|
18
|
+ stl.sttl_req_amt, /* 정산요청금액 */
|
|
19
|
+ stl.sttl_dt, /* 정산일자 */
|
|
20
|
+ <![CDATA[
|
|
21
|
+ CASE WHEN store.sttl_req_cfrm_term > 0 AND store.sttl_rcp_amt_term > 0 THEN
|
|
22
|
+ CASE WHEN stl.sttl_req_dt IS NULL THEN '정산요청전'
|
|
23
|
+ ELSE CASE WHEN stl.sttl_dt IS NULL
|
|
24
|
+ THEN CASE WHEN adddate(date_format(stl.sttl_req_dt, '%Y%m%d'), store.sttl_req_cfrm_term) < date_format(now(), '%Y-%m-%d')
|
|
25
|
+ THEN CASE WHEN adddate(date_format(stl.sttl_req_dt, '%Y%m%d'), store.sttl_req_cfrm_term + store.sttl_rcp_amt_term) < date_format(now(), '%Y-%m-%d')
|
|
26
|
+ THEN '정산미납'
|
|
27
|
+ ELSE '정산대기' END
|
|
28
|
+ ELSE '정산미확인' END
|
|
29
|
+ ELSE CASE WHEN adddate(date_format(stl.sttl_dt, '%Y%m%d'), store.sttl_rcp_amt_term) < date_format(now(), '%Y-%m-%d')
|
|
30
|
+ THEN '정산미납'
|
|
31
|
+ ELSE '정산대기' END
|
|
32
|
+ END
|
|
33
|
+ END
|
|
34
|
+ ELSE '정산대기'
|
|
35
|
+ END AS stl_st_nm, /* 상태 */
|
|
36
|
+ ]]>
|
|
37
|
+ stl.sttl_mgnt_unq_no /* 정산관리고유번호 */
|
|
38
|
+ FROM store_base_info store
|
|
39
|
+ INNER JOIN loan_mgnt_base_info loan
|
|
40
|
+ ON store.loan_mgnt_unq_no = loan.loan_mgnt_unq_no
|
|
41
|
+ AND store.loan_dvsn = loan.loan_dvsn
|
|
42
|
+ AND store.store_id = loan.store_id
|
|
43
|
+ AND loan.loan_dvsn = 'LD02'
|
|
44
|
+ AND loan.use_amt_total > 0
|
|
45
|
+ INNER JOIN stl_mgnt_base_info stl
|
|
46
|
+ ON store.store_id = stl.store_id
|
|
47
|
+ AND store.brand_id = stl.brand_id
|
|
48
|
+ AND stl.sttl_req_dt BETWEEN #{fromDt} AND #{toDt}
|
|
49
|
+ AND IFNULL(stl.rcpt_yn, 'N') = 'N' /* 수납여부(후불사용) */
|
19
|
50
|
WHERE 1 = 1
|
20
|
|
- AND A.sttl_st_cd = 'ST10' /* 정산요청 */
|
21
|
|
- AND A.brand_id = #{sBrandId}
|
|
51
|
+ AND store.brand_id = #{sBrandId}
|
22
|
52
|
<if test="sStoreId != null and sStoreId != ''">
|
23
|
|
- AND A.store_id = #{sStoreId}
|
24
|
|
- </if>
|
25
|
|
- <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
26
|
|
- AND A.sttl_req_dt BETWEEN #{fromDt} AND #{toDt}
|
|
53
|
+ AND store.store_id = #{sStoreId}
|
27
|
54
|
</if>
|
28
|
55
|
<choose>
|
29
|
56
|
<when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
30
|
57
|
<if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
31
|
58
|
<if test="gridRequest.sord == 'asc'.toString()">
|
32
|
|
- ORDER BY A.sttl_mgnt_unq_no ASC
|
|
59
|
+ ORDER BY stl.sttl_mgnt_unq_no ASC
|
33
|
60
|
</if>
|
34
|
61
|
<if test="gridRequest.sord == 'desc'.toString()">
|
35
|
|
- ORDER BY A.sttl_mgnt_unq_no DESC
|
|
62
|
+ ORDER BY stl.sttl_mgnt_unq_no DESC
|
36
|
63
|
</if>
|
37
|
64
|
</if>
|
38
|
65
|
</when>
|
39
|
66
|
<otherwise>
|
40
|
|
- ORDER BY A.sttl_mgnt_unq_no ASC
|
|
67
|
+ ORDER BY stl.sttl_mgnt_unq_no ASC
|
41
|
68
|
</otherwise>
|
42
|
69
|
</choose>
|
43
|
70
|
<if test="gridRequest.pagingYn == true">
|
|
@@ -48,17 +75,22 @@
|
48
|
75
|
<select id="selectUnpaidMngGridCnt" resultType="int">
|
49
|
76
|
/* UnpaidMngMapper.selectUnpaidMngGridCnt */
|
50
|
77
|
SELECT COUNT(*)
|
51
|
|
- FROM stl_mgnt_base_info A
|
52
|
|
- INNER JOIN store_base_info B ON A.brand_id = B.brand_id AND A.store_id = B.store_id
|
53
|
|
- INNER JOIN loan_mgnt_base_info C ON B.loan_mgnt_unq_no = C.loan_mgnt_unq_no
|
|
78
|
+ FROM store_base_info store
|
|
79
|
+ INNER JOIN loan_mgnt_base_info loan
|
|
80
|
+ ON store.loan_mgnt_unq_no = loan.loan_mgnt_unq_no
|
|
81
|
+ AND store.loan_dvsn = loan.loan_dvsn
|
|
82
|
+ AND store.store_id = loan.store_id
|
|
83
|
+ AND loan.loan_dvsn = 'LD02'
|
|
84
|
+ AND loan.use_amt_total > 0
|
|
85
|
+ INNER JOIN stl_mgnt_base_info stl
|
|
86
|
+ ON store.store_id = stl.store_id
|
|
87
|
+ AND store.brand_id = stl.brand_id
|
|
88
|
+ AND stl.sttl_req_dt BETWEEN #{fromDt} AND #{toDt}
|
|
89
|
+ AND IFNULL(stl.rcpt_yn, 'N') = 'N'
|
54
|
90
|
WHERE 1 = 1
|
55
|
|
- AND A.sttl_st_cd = 'ST10' /* 정산요청 */
|
56
|
|
- AND A.brand_id = #{sBrandId}
|
|
91
|
+ AND store.brand_id = #{sBrandId}
|
57
|
92
|
<if test="sStoreId != null and sStoreId != ''">
|
58
|
|
- AND A.store_id = #{sStoreId}
|
59
|
|
- </if>
|
60
|
|
- <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
61
|
|
- AND A.sttl_req_dt BETWEEN #{fromDt} AND #{toDt}
|
|
93
|
+ AND store.store_id = #{sStoreId}
|
62
|
94
|
</if>
|
63
|
95
|
</select>
|
64
|
96
|
|