통계 원복

This commit is contained in:
kubo8
2022-12-20 17:43:45 +09:00
parent 4883127139
commit 69b58ef18b
3 changed files with 407 additions and 330 deletions

View File

@@ -8,7 +8,7 @@ spring:
pool-name: hikari-cp pool-name: hikari-cp
maximum-pool-size: 30 maximum-pool-size: 30
minimum-idle: 5 minimum-idle: 5
connection-timeout: 20000 connection-timeout: 5000
connection-init-sql: SELECT 1 connection-init-sql: SELECT 1
validation-timeout: 2000 validation-timeout: 2000
idle-timeout: 600000 idle-timeout: 600000
@@ -22,7 +22,7 @@ spring:
pool-name: hikari-cp pool-name: hikari-cp
maximum-pool-size: 30 maximum-pool-size: 30
minimum-idle: 5 minimum-idle: 5
connection-timeout: 20000 connection-timeout: 5000
connection-init-sql: SELECT 1 connection-init-sql: SELECT 1
validation-timeout: 2000 validation-timeout: 2000
idle-timeout: 600000 idle-timeout: 600000

View File

@@ -8,9 +8,9 @@ spring:
pool-name: hikari-cp pool-name: hikari-cp
maximum-pool-size: 30 maximum-pool-size: 30
minimum-idle: 5 minimum-idle: 5
connection-timeout: 600000 connection-timeout: 5000
connection-init-sql: SELECT 1 connection-init-sql: SELECT 1
validation-timeout: 600000 validation-timeout: 2000
idle-timeout: 600000 idle-timeout: 600000
max-lifetime: 1800000 max-lifetime: 1800000
datasource-db2: datasource-db2:
@@ -22,9 +22,9 @@ spring:
pool-name: hikari-cp pool-name: hikari-cp
maximum-pool-size: 30 maximum-pool-size: 30
minimum-idle: 5 minimum-idle: 5
connection-timeout: 600000 connection-timeout: 5000
connection-init-sql: SELECT 1 connection-init-sql: SELECT 1
validation-timeout: 600000 validation-timeout: 2000
idle-timeout: 600000 idle-timeout: 600000
max-lifetime: 1800000 max-lifetime: 1800000

View File

@@ -546,338 +546,415 @@
<select id="selectCustMstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="int"> <select id="selectCustMstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="int">
/* stats-mapper.xml(selectCustMstatListTotalCnt) */ /* stats-mapper.xml(selectCustMstatListTotalCnt) */
SELECT SELECT
COUNT(S1.SUM_YM) AS TOTALCNT COUNT(*) AS TOTALCNT
FROM FROM
( (
SELECT <!-- 추가분 (시작) -->
SUM_YM, USER_SEQ SELECT
FROM DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
( ,ewm.USER_SEQ
SELECT ,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM
SUM_YM, ,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO
USER_SEQ, FROM
SND_CH_CD, hubez_common.EZ_WEB_MSG ewm
IFNULL(SUM(SND_CNT), 0) AS SND_CNT, INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT, WHERE
0 AS FBACK_CNT, 1 = 1
0 AS FBACK_SUCC_CNT AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
FROM AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
hubez_common.EZ_CUST_MSTAT GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ
WHERE UNION ALL
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') <!-- 추가분 (끝) -->
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD SELECT
UNION ALL SUM_YM
SELECT ,USER_SEQ
SUM_YM, ,CUST_NM
USER_SEQ, ,BIZRNO
RPLCSND_CH_CD AS SND_CH_CD, FROM hubez_common.EZ_CUST_MSTAT
0 AS SND_CNT, WHERE 1=1
0 AS SUCC_CNT, AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT, GROUP BY SUM_YM, USER_SEQ
IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT ) A
FROM WHERE 1=1
hubez_common.EZ_CUST_MSTAT <include refid="custMstatListCondition"/>
WHERE
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS')
GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD
UNION ALL
SELECT
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
esu.PRNTS_USER_SEQ AS USER_SEQ,
REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD,
SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT,
SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT,
0 AS FBACK_CNT,
0 AS FBACK_SUCC_CNT
FROM
hubez_common.EZ_WEB_MSG ewm INNER JOIN
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
WHERE
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR
UNION ALL
SELECT
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM,
esu.PRNTS_USER_SEQ AS USER_SEQ,
FB_CH_STR AS SND_CH_CD,
0 AS SND_CNT,
0 AS SUCC_CNT,
SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT,
SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
FROM
hubez_common.EZ_WEB_MSG ewm INNER JOIN
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
WHERE
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d')
AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0)
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR
) T1
WHERE
1 = 1
GROUP BY SUM_YM, USER_SEQ
) S1,
hubez_common.EZ_SUBS_INFO S2,
hubez_common.EZ_CUST_INFO S3
WHERE
S1.USER_SEQ = S2.USER_SEQ
AND S2.CUST_SEQ = S3.CUST_SEQ
AND S3.BIZRNO != '1234567890'
<include refid="custMstatListCondition"/>
</select> </select>
<select id="selectCustMstatList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList"> <select id="selectCustMstatList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList">
/* stats-mapper.xml(selectCustMstatList) */ /* stats-mapper.xml(selectCustMstatList) */
SELECT select DATE_FORMAT(t1.SUM_YM, '%Y-%m') AS sumYm
DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno, , t1.CUST_NM AS custNm
(S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt, , t1.BIZRNO AS bizrno
(S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt, , SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS sndCnt
IFNULL(ROUND(((S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) / (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR)) * 100, 2), 0) AS succRt, , SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) AS succCnt
S1.sndCntS, S1.succCntS, IFNULL(ROUND((S1.succCntS/S1.sndCntS)*100,2),0) AS succRtS, , IFNULL(TRUNCATE(SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) / SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) * 100, 2),0) as succRt
S1.sndCntL, S1.succCntL, IFNULL(ROUND((S1.succCntL/S1.sndCntL)*100,2),0) AS succRtL, , SUM(t2.sndCntS) AS sndCntS
S1.sndCntM, S1.succCntM, IFNULL(ROUND((S1.succCntM/S1.sndCntM)*100,2),0) AS succRtM, , SUM(t2.succCntS) AS succCntS
S1.sndCntR, S1.succCntR, IFNULL(ROUND((S1.succCntR/S1.sndCntR)*100,2),0) AS succRtR, , IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0) AS succRtS
S1.fbSndCntS, S1.fbSuccCntS, IFNULL(ROUND((S1.fbSuccCntS/S1.fbSndCntS)*100,2),0) AS succFbRtS, , SUM(t2.sndCntL) AS sndCntL
S1.fbSndCntL, S1.fbSuccCntL, IFNULL(ROUND((S1.fbSuccCntL/S1.fbSndCntL)*100,2),0) AS succFbRtL, , SUM(t2.succCntL) AS succCntL
S1.fbSndCntM, S1.fbSuccCntM, IFNULL(ROUND((S1.fbSuccCntM/S1.fbSndCntM)*100,2),0) AS succFbRtM , IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) AS succRtL
FROM , SUM(t2.sndCntM) AS sndCntM
( , SUM(t2.succCntM) AS succCntM
SELECT , IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0) AS succRtM
SUM_YM, USER_SEQ, , SUM(t2.sndCntR) AS sndCntR
SUM(sndCntS) AS sndCntS, SUM(succCntS) AS succCntS, SUM(sndCntL) AS sndCntL, SUM(succCntL) AS succCntL, SUM(sndCntM) AS sndCntM, , SUM(t2.succCntR) AS succCntR
SUM(succCntM) AS succCntM, SUM(sndCntR) AS sndCntR, SUM(succCntR) AS succCntR, SUM(fbSndCntS) AS fbSndCntS, SUM(fbSuccCntS) AS fbSuccCntS, , IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0) AS succRtR
SUM(fbSndCntL) AS fbSndCntL, SUM(fbSuccCntL) AS fbSuccCntL, SUM(fbSndCntM) AS fbSndCntM, SUM(fbSuccCntM) AS fbSuccCntM from (
FROM <!-- 추가분 (시작) -->
( SELECT
SELECT DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
SUM_YM, USER_SEQ, ,ewm.USER_SEQ
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS, ,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS, ,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL, FROM
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL, hubez_common.EZ_WEB_MSG ewm
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM, INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM, WHERE
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR, 1 = 1
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR, AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS, AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS, GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntL, UNION ALL
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL, <!-- 추가분 (끝) -->
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM, select SUM_YM
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM , USER_SEQ
FROM , BIZRNO
( , CUST_NM
SELECT from (
SUM_YM, select ecm.SUM_YM
USER_SEQ, , ecm.USER_SEQ
SND_CH_CD, , ecm.BIZRNO
IFNULL(SUM(SND_CNT), 0) AS SND_CNT, , ecm.CUST_NM
IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT, from hubez_common.EZ_CUST_MSTAT ecm
0 AS FBACK_CNT, where 1=1
0 AS FBACK_SUCC_CNT AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
FROM <include refid="custMstatListCondition"/>
hubez_common.EZ_CUST_MSTAT group by ecm.SUM_YM , ecm.USER_SEQ <!-- ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ -->
WHERE ) list
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') LIMIT #{page}, #{pagePerRows}
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD ) t1 inner join (
UNION ALL select SUM_YM
SELECT , USER_SEQ
SUM_YM, , sum(smsSndCnt) AS sndCntS
USER_SEQ, , sum(smsSuccCnt) AS succCntS
RPLCSND_CH_CD AS SND_CH_CD, , sum(smsSuccRt) AS succRtS
0 AS SND_CNT, , sum(lmsSndCnt) AS sndCntL
0 AS SUCC_CNT, , sum(lmsSuccCnt) AS succCntL
IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT, , sum(lmsSuccRt) AS succRtL
IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT , sum(mmsSndCnt) AS sndCntM
FROM , sum(mmsSuccCnt) AS succCntM
hubez_common.EZ_CUST_MSTAT , sum(mmsSuccRt) AS succRtM
WHERE , sum(alimtSndCnt) AS sndCntR
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') , sum(alimtSuccCnt) AS succCntR
AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS') , sum(alimtSuccRt) AS succRtR
GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD from (
UNION ALL select SUM_YM
SELECT , USER_SEQ
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM, , case when sndChCd = 'SMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
esu.PRNTS_USER_SEQ AS USER_SEQ, else 0
REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD, end as smsSndCnt
SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT, , case when sndChCd = 'SMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT, else 0
0 AS FBACK_CNT, end as smsSuccCnt
0 AS FBACK_SUCC_CNT , case when sndChCd = 'SMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
FROM else 0
hubez_common.EZ_WEB_MSG ewm INNER JOIN end as smsSuccRt
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ , case when sndChCd = 'LMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
WHERE else 0
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d') end as lmsSndCnt
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR , case when sndChCd = 'LMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
UNION ALL else 0
SELECT end as lmsSuccCnt
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM, , case when sndChCd = 'LMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
esu.PRNTS_USER_SEQ AS USER_SEQ, else 0
FB_CH_STR AS SND_CH_CD, end as lmsSuccRt
0 AS SND_CNT, , case when sndChCd = 'MMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
0 AS SUCC_CNT, else 0
SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT, end as mmsSndCnt
SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT , case when sndChCd = 'MMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
FROM else 0
hubez_common.EZ_WEB_MSG ewm INNER JOIN end as mmsSuccCnt
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ , case when sndChCd = 'MMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
WHERE else 0
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d') end as mmsSuccRt
AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0) , case when sndChCd = 'ALIMTALK' then SUM(SND_CNT) + SUM(FBACK_CNT)
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR else 0
) T1 end as alimtSndCnt
WHERE , case when sndChCd = 'ALIMTALK' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
1 = 1 else 0
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD end as alimtSuccCnt
) T2 , case when sndChCd = 'ALIMTALK' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
WHERE else 0
1 = 1 end as alimtSuccRt
GROUP BY SUM_YM, USER_SEQ from (
) S1, <!-- 추가분 (시작) -->
hubez_common.EZ_SUBS_INFO S2, SELECT
hubez_common.EZ_CUST_INFO S3 DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
WHERE ,ewm.USER_SEQ
S1.USER_SEQ = S2.USER_SEQ ,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd
AND S2.CUST_SEQ = S3.CUST_SEQ ,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT
AND S3.BIZRNO != '1234567890' ,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT
<include refid="custMstatListCondition"/> ,SUM(IFNULL(ewm.FAIL_CNT, 0)) AS FAIL_CNT
ORDER BY S1.SUM_YM DESC, S3.CUST_NM ,SUM(IFNULL(ewm.FB_SUCC_CNT , 0)) + SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT
LIMIT #{page}, #{pagePerRows} ,SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
,SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_FAIL_CNT
FROM
hubez_common.EZ_WEB_MSG ewm INNER JOIN
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
WHERE
1 = 1
AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
GROUP BY
DATE_FORMAT(ewm.REG_DT, '%Y-%m'), ewm.USER_SEQ , ewm.CH_STR
UNION ALL
<!-- 추가분 (끝) -->
select ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD as sndChCd
, ifnull(sum(SND_CNT) , 0) as SND_CNT
, ifnull(sum(SUCC_CNT) , 0) as SUCC_CNT
, ifnull(sum(FAIL_CNT) , 0) as FAIL_CNT
, 0 as FBACK_CNT
, 0 as FBACK_SUCC_CNT
, 0 as FBACK_FAIL_CNT
from hubez_common.EZ_CUST_MSTAT ecm
inner join (
select SUM_YM
, USER_SEQ
from (
select ecm.SUM_YM
, ecm.USER_SEQ
from hubez_common.EZ_CUST_MSTAT ecm
where 1=1
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
<include refid="custMstatListCondition"/>
group by ecm.SUM_YM , ecm.USER_SEQ
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
) list
LIMIT #{page}, #{pagePerRows}
) list
on list.SUM_YM = ecm.SUM_YM and list.USER_SEQ = ecm.USER_SEQ
where ecm.SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
group by ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD -- , RPLCSND_CH_CD
union all
select ecm.SUM_YM, ecm.USER_SEQ, ecm.RPLCSND_CH_CD as sndChCd
, 0 as SND_CNT
, 0 as SUCC_CNT
, 0 as FAIL_CNT
, ifnull(sum(FBACK_CNT) , 0) as FBACK_CNT
, ifnull(sum(FBACK_SUCC_CNT) , 0) as FBACK_SUCC_CNT
, ifnull(sum(FBACK_FAIL_CNT) , 0) as FBACK_FAIL_CNT
from hubez_common.EZ_CUST_MSTAT ecm
inner join (
select SUM_YM
, USER_SEQ
from (
select ecm.SUM_YM
, ecm.USER_SEQ
from hubez_common.EZ_CUST_MSTAT ecm
where 1=1
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
<include refid="custMstatListCondition"/>
group by ecm.SUM_YM , ecm.USER_SEQ
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
) list
LIMIT #{page}, #{pagePerRows}
) list
on list.SUM_YM = ecm.SUM_YM and list.USER_SEQ = ecm.USER_SEQ
where ecm.SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
and RPLCSND_CH_CD in ('SMS', 'LMS', 'MMS', 'ALIMTALK')
group by ecm.SUM_YM, ecm.USER_SEQ, ecm.RPLCSND_CH_CD
) t1 group by SUM_YM, USER_SEQ, sndChCd order by null
) t2 group by SUM_YM, USER_SEQ order by null
) t2 on t2.SUM_YM = t1.SUM_YM and t2.USER_SEQ = t1.USER_SEQ
WHERE 1=1
<include refid="custMstatListCondition"/>
GROUP BY t1.BIZRNO, t1.SUM_YM
ORDER BY t1.SUM_YM desc, t1.CUST_NM
</select> </select>
<select id="selectCustMstatExcelList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthListExcelReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList"> <select id="selectCustMstatExcelList" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmMonthListExcelReqDto" resultType="kr.co.uplus.ez.api.stats.dto.BsnmMonthList">
/* stats-mapper.xml(selectCustMstatExcelList) */ /* stats-mapper.xml(selectCustMstatExcelList) */
SELECT select DATE_FORMAT(t1.SUM_YM, '%Y-%m') AS sumYm
sumYm, custNm, bizrno, , t1.CUST_NM AS custNm
sndCnt, CONCAT(succCnt,'(',succRt,'%)') AS succCnt, , t1.BIZRNO AS bizrno
sndCntS, CONCAT(succCntS,'(',succRtS,'%)') AS succCntS, , SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) AS sndCnt
sndCntL, CONCAT(succCntL,'(',succRtL,'%)') AS succCntL, , CONCAT(SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR),'(',(TRUNCATE(SUM(t2.succCntS + t2.succCntL + t2.succCntM + t2.succCntR) / SUM(t2.sndCntS + t2.sndCntL + t2.sndCntM + t2.sndCntR) * 100, 2)),'%)') AS succCnt
sndCntM, CONCAT(succCntM,'(',succRtM,'%)') AS succCntM, , SUM(t2.sndCntS)
sndCntR, CONCAT(succCntR,'(',succRtR,'%)') AS succCntR, , CONCAT(SUM(t2.succCntS), '(', IFNULL(TRUNCATE((SUM(t2.succCntS) / SUM(t2.sndCntS)) * 100, 2), 0), '%)') AS succCntS
fbSndCntS, CONCAT(fbSuccCntS,'(',succFbRtS,'%)') AS fbSuccCntS, , SUM(t2.sndCntL)
fbSndCntL, CONCAT(fbSuccCntL,'(',succFbRtL,'%)') AS fbSuccCntL, , CONCAT(SUM(t2.succCntL), '(', IFNULL(TRUNCATE((SUM(t2.succCntL) / SUM(t2.sndCntL)) * 100, 2), 0) , '%)') AS succCntL
fbSndCntM, CONCAT(fbSuccCntM,'(',succFbRtM,'%)') AS fbSuccCntM , SUM(t2.sndCntM)
FROM , CONCAT(SUM(t2.succCntM), '(', IFNULL(TRUNCATE((SUM(t2.succCntM) / SUM(t2.sndCntM)) * 100, 2), 0), '%)') AS succCntM
( , SUM(t2.sndCntR)
SELECT , CONCAT(SUM(t2.succCntR), '(', IFNULL(TRUNCATE((SUM(t2.succCntR) / SUM(t2.sndCntR)) * 100, 2), 0), '%)') AS succCntR
DATE_FORMAT(S1.SUM_YM, '%Y-%m') AS sumYm, S3.CUST_NM AS custNm, S3.BIZRNO AS bizrno, from (
(S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR) AS sndCnt, select SUM_YM
(S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) AS succCnt, , USER_SEQ
IFNULL(ROUND(((S1.succCntS + S1.succCntL +S1.succCntM +S1.succCntR + fbSuccCntS + fbSuccCntL+ fbSuccCntM) / (S1.sndCntS + S1.sndCntL + S1.sndCntM + S1.sndCntR)) * 100, 2), 0) AS succRt, , BIZRNO
S1.sndCntS, S1.succCntS, IFNULL(ROUND((S1.succCntS/S1.sndCntS)*100,2),0) AS succRtS, , CUST_NM
S1.sndCntL, S1.succCntL, IFNULL(ROUND((S1.succCntL/S1.sndCntL)*100,2),0) AS succRtL, from (
S1.sndCntM, S1.succCntM, IFNULL(ROUND((S1.succCntM/S1.sndCntM)*100,2),0) AS succRtM, select ecm.SUM_YM
S1.sndCntR, S1.succCntR, IFNULL(ROUND((S1.succCntR/S1.sndCntR)*100,2),0) AS succRtR, , ecm.USER_SEQ
S1.fbSndCntS, S1.fbSuccCntS, IFNULL(ROUND((S1.fbSuccCntS/S1.fbSndCntS)*100,2),0) AS succFbRtS, , ecm.BIZRNO
S1.fbSndCntL, S1.fbSuccCntL, IFNULL(ROUND((S1.fbSuccCntL/S1.fbSndCntL)*100,2),0) AS succFbRtL, , ecm.CUST_NM
S1.fbSndCntM, S1.fbSuccCntM, IFNULL(ROUND((S1.fbSuccCntM/S1.fbSndCntM)*100,2),0) AS succFbRtM from hubez_common.EZ_CUST_MSTAT ecm
FROM where 1=1
( AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
SELECT <include refid="custMstatListCondition"/>
SUM_YM, USER_SEQ, group by ecm.SUM_YM , ecm.USER_SEQ
SUM(sndCntS) AS sndCntS, SUM(succCntS) AS succCntS, SUM(sndCntL) AS sndCntL, SUM(succCntL) AS succCntL, SUM(sndCntM) AS sndCntM, -- ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
SUM(succCntM) AS succCntM, SUM(sndCntR) AS sndCntR, SUM(succCntR) AS succCntR, SUM(fbSndCntS) AS fbSndCntS, SUM(fbSuccCntS) AS fbSuccCntS, ) list
SUM(fbSndCntL) AS fbSndCntL, SUM(fbSuccCntL) AS fbSuccCntL, SUM(fbSndCntM) AS fbSndCntM, SUM(fbSuccCntM) AS fbSuccCntM <!-- 추가분 (시작) -->
FROM UNION ALL
( SELECT
SELECT DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
SUM_YM, USER_SEQ, ,ewm.USER_SEQ
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntS, ,(SELECT BIZRNO FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as BIZRNO
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntS, ,(SELECT CUST_NM FROM hubez_common.EZ_CUST_INFO ci WHERE ci.CUST_SEQ = esu.CUST_SEQ) as CUST_NM
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntL, FROM
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntL, hubez_common.EZ_WEB_MSG ewm
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SND_CNT) ELSE 0 END AS sndCntM, INNER JOIN hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntM, WHERE
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SND_CNT) ELSE 0 END AS sndCntR, 1 = 1
CASE WHEN SND_CH_CD = 'ALIMTALK' THEN SUM(SUCC_CNT) ELSE 0 END AS succCntR, AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntS, AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
CASE WHEN SND_CH_CD = 'SMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntS, GROUP BY DATE_FORMAT(ewm.REG_DT, '%Y-%m') , ewm.USER_SEQ
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntL, <!-- 추가분 (끝) -->
CASE WHEN SND_CH_CD = 'LMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntL, ) t1 inner join (
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_CNT) ELSE 0 END AS fbSndCntM, select SUM_YM
CASE WHEN SND_CH_CD = 'MMS' THEN SUM(FBACK_SUCC_CNT) ELSE 0 END AS fbSuccCntM , USER_SEQ
FROM , sum(smsSndCnt) AS sndCntS
( , sum(smsSuccCnt) AS succCntS
SELECT , sum(smsSuccRt) AS succRtS
SUM_YM, , sum(lmsSndCnt) AS sndCntL
USER_SEQ, , sum(lmsSuccCnt) AS succCntL
SND_CH_CD, , sum(lmsSuccRt) AS succRtL
IFNULL(SUM(SND_CNT), 0) AS SND_CNT, , sum(mmsSndCnt) AS sndCntM
IFNULL(SUM(SUCC_CNT), 0) AS SUCC_CNT, , sum(mmsSuccCnt) AS succCntM
0 AS FBACK_CNT, , sum(mmsSuccRt) AS succRtM
0 AS FBACK_SUCC_CNT , sum(alimtSndCnt) AS sndCntR
FROM , sum(alimtSuccCnt) AS succCntR
hubez_common.EZ_CUST_MSTAT , sum(alimtSuccRt) AS succRtR
WHERE from (
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') select SUM_YM
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD , USER_SEQ
UNION ALL , case when sndChCd = 'SMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
SELECT else 0
SUM_YM, end as smsSndCnt
USER_SEQ, , case when sndChCd = 'SMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
RPLCSND_CH_CD AS SND_CH_CD, else 0
0 AS SND_CNT, end as smsSuccCnt
0 AS SUCC_CNT, , case when sndChCd = 'SMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
IFNULL(SUM(FBACK_CNT), 0) AS FBACK_CNT, else 0
IFNULL(SUM(FBACK_SUCC_CNT), 0) AS FBACK_SUCC_CNT end as smsSuccRt
FROM , case when sndChCd = 'LMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
hubez_common.EZ_CUST_MSTAT else 0
WHERE end as lmsSndCnt
SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d') , case when sndChCd = 'LMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
AND RPLCSND_CH_CD IN ('SMS', 'LMS', 'MMS') else 0
GROUP BY SUM_YM, USER_SEQ, RPLCSND_CH_CD end as lmsSuccCnt
UNION ALL , case when sndChCd = 'LMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
SELECT else 0
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM, end as lmsSuccRt
esu.PRNTS_USER_SEQ AS USER_SEQ, , case when sndChCd = 'MMS' then SUM(SND_CNT) + SUM(FBACK_CNT)
REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS SND_CH_CD, else 0
SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT, end as mmsSndCnt
SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT, , case when sndChCd = 'MMS' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
0 AS FBACK_CNT, else 0
0 AS FBACK_SUCC_CNT end as mmsSuccCnt
FROM , case when sndChCd = 'MMS' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
hubez_common.EZ_WEB_MSG ewm INNER JOIN else 0
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ end as mmsSuccRt
WHERE , case when sndChCd = 'ALIMTALK' then SUM(SND_CNT) + SUM(FBACK_CNT)
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d') else 0
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.CH_STR end as alimtSndCnt
UNION ALL , case when sndChCd = 'ALIMTALK' then SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)
SELECT else 0
DATE_FORMAT(ewm.YMD, '%Y-%m-01') AS SUM_YM, end as alimtSuccCnt
esu.PRNTS_USER_SEQ AS USER_SEQ, , case when sndChCd = 'ALIMTALK' then TRUNCATE((SUM(SUCC_CNT) + SUM(FBACK_SUCC_CNT)) / (SUM(SND_CNT) + SUM(FBACK_CNT)) * 100, 2)
FB_CH_STR AS SND_CH_CD, else 0
0 AS SND_CNT, end as alimtSuccRt
0 AS SUCC_CNT, from (
SUM(IFNULL(ewm.FB_SUCC_CNT + ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT, <!-- 추가분 (시작) -->
SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT SELECT
FROM DATE_FORMAT(ewm.REG_DT , '%Y-%m-01') AS SUM_YM
hubez_common.EZ_WEB_MSG ewm INNER JOIN ,ewm.USER_SEQ
hubez_common.EZ_SVC_USER esu ON ewm.USER_SEQ = esu.USER_SEQ ,REPLACE (ewm.CH_STR ,'KKO_NOTI', 'ALIMTALK') AS sndChCd
WHERE ,SUM(IFNULL(ewm.SEND_CNT, 0)) AS SND_CNT
ewm.YMD BETWEEN DATE_FORMAT( NOW(), '%Y-%m-01') AND DATE_FORMAT( NOW(), '%Y-%m-%d') ,SUM(IFNULL(ewm.SUCC_CNT, 0)) AS SUCC_CNT
AND (FB_SUCC_CNT > 0 OR FB_FAIL_CNT > 0) ,SUM(IFNULL(ewm.FAIL_CNT, 0)) AS FAIL_CNT
GROUP BY ewm.YMD, esu.PRNTS_USER_SEQ, ewm.FB_CH_STR ,SUM(IFNULL(ewm.FB_SUCC_CNT , 0)) + SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_CNT
) T1 ,SUM(IFNULL(ewm.FB_SUCC_CNT, 0)) AS FBACK_SUCC_CNT
WHERE ,SUM(IFNULL(ewm.FB_FAIL_CNT, 0)) AS FBACK_FAIL_CNT
1 = 1 FROM
GROUP BY SUM_YM, USER_SEQ, SND_CH_CD hubez_common.EZ_WEB_MSG ewm
) T2 WHERE
WHERE 1 = 1
1 = 1 AND #{endMon} = DATE_FORMAT( NOW(), '%Y%m')
GROUP BY SUM_YM, USER_SEQ AND DATE_FORMAT( ewm.REG_DT, '%Y-%m') = DATE_FORMAT( NOW(), '%Y-%m')
) S1, GROUP BY
hubez_common.EZ_SUBS_INFO S2, DATE_FORMAT(ewm.REG_DT, '%Y-%m'), ewm.USER_SEQ , ewm.CH_STR
hubez_common.EZ_CUST_INFO S3 UNION ALL
WHERE <!-- 추가분 (끝) -->
S1.USER_SEQ = S2.USER_SEQ select ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD as sndChCd
AND S2.CUST_SEQ = S3.CUST_SEQ , ifnull(sum(SND_CNT) , 0) as SND_CNT
AND S3.BIZRNO != '1234567890' , ifnull(sum(SUCC_CNT) , 0) as SUCC_CNT
<include refid="custMstatListCondition"/> , ifnull(sum(FAIL_CNT) , 0) as FAIL_CNT
) M , 0 as FBACK_CNT
WHERE , 0 as FBACK_SUCC_CNT
1 = 1 , 0 as FBACK_FAIL_CNT
ORDER BY M.sumYm DESC, M.custNm from hubez_common.EZ_CUST_MSTAT ecm
inner join (
select SUM_YM
, USER_SEQ
from (
select ecm.SUM_YM
, ecm.USER_SEQ
from hubez_common.EZ_CUST_MSTAT ecm
where 1=1
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
<include refid="custMstatListCondition"/>
group by ecm.SUM_YM , ecm.USER_SEQ
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
) list
) list
on list.SUM_YM = ecm.SUM_YM and list.USER_SEQ = ecm.USER_SEQ
where ecm.SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
group by ecm.SUM_YM, ecm.USER_SEQ, SND_CH_CD -- , RPLCSND_CH_CD
union all
select ecm.SUM_YM, ecm.USER_SEQ, ecm.RPLCSND_CH_CD as sndChCd
, 0 as SND_CNT
, 0 as SUCC_CNT
, 0 as FAIL_CNT
, ifnull(sum(FBACK_CNT) , 0) as FBACK_CNT
, ifnull(sum(FBACK_SUCC_CNT) , 0) as FBACK_SUCC_CNT
, ifnull(sum(FBACK_FAIL_CNT) , 0) as FBACK_FAIL_CNT
from hubez_common.EZ_CUST_MSTAT ecm
inner join (
select SUM_YM
, USER_SEQ
from (
select ecm.SUM_YM
, ecm.USER_SEQ
from hubez_common.EZ_CUST_MSTAT ecm
where 1=1
AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
<include refid="custMstatListCondition"/>
group by ecm.SUM_YM , ecm.USER_SEQ
ORDER BY ecm.SUM_YM DESC, ecm.USER_SEQ
) list
) list
on list.SUM_YM = ecm.SUM_YM and list.USER_SEQ = ecm.USER_SEQ
where ecm.SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
and RPLCSND_CH_CD in ('SMS', 'LMS', 'MMS', 'ALIMTALK')
group by ecm.SUM_YM, ecm.USER_SEQ, ecm.RPLCSND_CH_CD
) t1 group by SUM_YM, USER_SEQ, sndChCd order by null
) t2 group by SUM_YM, USER_SEQ order by null
) t2 on t2.SUM_YM = t1.SUM_YM and t2.USER_SEQ = t1.USER_SEQ
WHERE 1=1
<include refid="custMstatListCondition"/>
GROUP BY t1.BIZRNO, t1.SUM_YM
ORDER BY t1.SUM_YM desc, t1.CUST_NM
</select> </select>
<select id="selectCustDstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="int"> <select id="selectCustDstatListTotalCnt" parameterType="kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto" resultType="int">