월별,일별통계 수정

This commit is contained in:
USER
2022-07-28 17:53:57 +09:00
parent f3fb920b35
commit abb5db5b97

View File

@@ -5,316 +5,498 @@
<select id="selectMonStatList" parameterType="kr.co.uplus.ez.api.stats.dto.MonthListReqDto" resultType="kr.co.uplus.ez.api.stats.dto.MonthList"> <select id="selectMonStatList" parameterType="kr.co.uplus.ez.api.stats.dto.MonthListReqDto" resultType="kr.co.uplus.ez.api.stats.dto.MonthList">
/* stats-mapper.xml(selectMonStatList) */ /* stats-mapper.xml(selectMonStatList) */
SELECT * FROM (
SELECT
'전체' AS sumYm
, IFNULL(ecm1.SND_CNT,0) AS sndCnt
, IFNULL(ecm1.SUCC_CNT,0) AS succCnt
, IFNULL(ecm1.SUCC_RT,0) AS succRt
, IFNULL(S1.SND_CNT,0) AS sndCntS
, IFNULL(S1.SUCC_CNT,0) AS succCntS
, IFNULL(S1.SUCC_RT,0) AS succRtS
, IFNULL(L1.SND_CNT,0) AS sndCntL
, IFNULL(L1.SUCC_CNT,0) AS succCntL
, IFNULL(L1.SUCC_RT,0) AS succRtL select '전체' AS sumYm
, IFNULL(M1.SND_CNT,0) AS sndCntM , sum(T_SND_CNT) AS sndCnt
, IFNULL(M1.SUCC_CNT,0) AS succCntM , sum(T_SUCC_CNT) AS succCnt
, IFNULL(M1.SUCC_RT,0) AS succRtM , sum(T_SUCC_RT) AS succRt
, IFNULL(A1.SND_CNT,0) AS sndCntR , sum(S_SND_CNT) AS sndCntS
, IFNULL(A1.SUCC_CNT,0) AS succCntR , sum(S_SUCC_CNT) AS succCntS
, IFNULL(A1.SUCC_RT,0) AS succRtR , sum(S_SUCC_RT) AS succRtS
FROM , sum(L_SND_CNT) AS sndCntL
(SELECT , sum(L_SUCC_CNT) AS succCntL
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , sum(L_SUCC_RT) AS succRtL
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , sum(M_SND_CNT) AS sndCntM
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT , sum(M_SUCC_CNT) AS succCntM
FROM , sum(M_SUCC_RT) AS succRtM
hubez_common.EZ_MON_STAT , sum(A_SND_CNT) AS sndCntR
, sum(A_SUCC_CNT) AS succCntR
, sum(A_SUCC_RT) AS succRtR
from (
SELECT SUM(IFNULL(SND_CNT,0)) AS T_SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS T_SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
WHERE 1=1 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') AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
) ecm1, union all
( SELECT 0 as T_SND_CNT
SELECT , 0 as T_SUCC_CNT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as T_SUCC_RT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , SUM(IFNULL(SND_CNT,0)) AS S_SND_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT , SUM(IFNULL(SUCC_CNT,0)) AS S_SUCC_CNT
FROM , ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS S_SUCC_RT
hubez_common.EZ_MON_STAT , 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
WHERE 1=1 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') AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
AND SND_CH_CD = 'SMS' AND SND_CH_CD = 'SMS'
) S1, union all
( SELECT 0 as T_SND_CNT
SELECT , 0 as T_SUCC_CNT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as T_SUCC_RT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , 0 as S_SND_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT , 0 as S_SUCC_CNT
FROM , 0 as S_SUCC_RT
hubez_common.EZ_MON_STAT , SUM(IFNULL(SND_CNT,0)) AS L_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS L_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
WHERE 1=1 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') AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
AND SND_CH_CD = 'LMS' AND SND_CH_CD = 'LMS'
) L1, union all
( SELECT 0 as T_SND_CNT
SELECT , 0 as T_SUCC_CNT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as T_SUCC_RT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , 0 as S_SND_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT , 0 as S_SUCC_CNT
FROM , 0 as S_SUCC_RT
hubez_common.EZ_MON_STAT , 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS M_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS M_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
WHERE 1=1 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') AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
AND SND_CH_CD = 'MMS' AND SND_CH_CD = 'MMS'
) M1, union all
( SELECT 0 as T_SND_CNT
SELECT , 0 as T_SUCC_CNT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as T_SUCC_RT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , 0 as S_SND_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100),2) AS SUCC_RT , 0 as S_SUCC_CNT
FROM , 0 as S_SUCC_RT
hubez_common.EZ_MON_STAT , 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS A_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS A_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
WHERE 1=1 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') AND SUM_YM BETWEEN STR_TO_DATE(CONCAT(#{startMon},'01'),'%Y%m%d') AND STR_TO_DATE(CONCAT(#{endMon},'01'),'%Y%m%d')
AND SND_CH_CD = 'ALIMTALK' AND SND_CH_CD = 'ALIMTALK'
) A1
UNION ALL
SELECT
DATE_FORMAT(ecm.SUM_YM, '%Y-%m') AS sumYm
, ecm.SND_CNT AS sndCnt
, ecm.SUCC_CNT AS succCnt
, ecm.SUCC_RT AS succRt
, S.SND_CNT AS sndCntS
, S.SUCC_CNT AS succCntS
, S.SUCC_RT AS succRtS
, L.SND_CNT AS sndCntL
, L.SUCC_CNT AS succCntL
, L.SUCC_RT AS succRtL
, M.SND_CNT AS sndCntM
, M.SUCC_CNT AS succCntM
, M.SUCC_RT AS succRtM
, A.SND_CNT AS sndCntR
, A.SUCC_CNT AS succCntR
, A.SUCC_RT AS succRtR
FROM
(SELECT
SUM_YM
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT
FROM
hubez_common.EZ_MON_STAT
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')
GROUP BY SUM_YM ) ecm,
(SELECT
SUM_YM
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT
FROM
hubez_common.EZ_MON_STAT
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')
AND SND_CH_CD = 'SMS'
GROUP BY SUM_YM ) S,
(SELECT
SUM_YM
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT
FROM
hubez_common.EZ_MON_STAT
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')
AND SND_CH_CD = 'LMS'
GROUP BY SUM_YM ) L,
( SELECT
SUM_YM
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT
FROM
hubez_common.EZ_MON_STAT
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')
AND SND_CH_CD = 'MMS'
GROUP BY SUM_YM ) M,
( SELECT
SUM_YM
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100),2) AS SUCC_RT
FROM
hubez_common.EZ_MON_STAT
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')
AND SND_CH_CD = 'ALIMTALK'
GROUP BY SUM_YM ) A
WHERE 1=1
AND ecm.SUM_YM = S.SUM_YM
AND ecm.SUM_YM = L.SUM_YM
AND ecm.SUM_YM = M.SUM_YM
AND ecm.SUM_YM = A.SUM_YM
) T ) T
ORDER BY sumYm DESC UNION ALL
select DATE_FORMAT(SUM_YM, '%Y-%m-%d') AS sumYm
, sum(T_SND_CNT) AS sndCnt
, sum(T_SUCC_CNT) AS succCnt
, sum(T_SUCC_RT) AS succRt
, sum(S_SND_CNT) AS sndCntS
, sum(S_SUCC_CNT) AS succCntS
, sum(S_SUCC_RT) AS succRtS
, sum(L_SND_CNT) AS sndCntL
, sum(L_SUCC_CNT) AS succCntL
, sum(L_SUCC_RT) AS succRtL
, sum(M_SND_CNT) AS sndCntM
, sum(M_SUCC_CNT) AS succCntM
, sum(M_SUCC_RT) AS succRtM
, sum(A_SND_CNT) AS sndCntR
, sum(A_SUCC_CNT) AS succCntR
, sum(A_SUCC_RT) AS succRtR
from (
SELECT SUM_YM
, SUM(IFNULL(SND_CNT,0)) AS T_SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS T_SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
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')
GROUP BY SUM_YM
union all
SELECT SUM_YM
, 0 as T_SND_CNT
, 0 as T_SUCC_CNT
, 0 as T_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS S_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS S_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
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')
AND SND_CH_CD = 'SMS'
GROUP BY SUM_YM
union all
SELECT SUM_YM
, 0 as T_SND_CNT
, 0 as T_SUCC_CNT
, 0 as T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS L_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS L_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
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')
AND SND_CH_CD = 'LMS'
GROUP BY SUM_YM
union all
SELECT SUM_YM
, 0 as T_SND_CNT
, 0 as T_SUCC_CNT
, 0 as T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS M_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS M_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
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')
AND SND_CH_CD = 'MMS'
GROUP BY SUM_YM
union all
SELECT SUM_YM
, 0 as T_SND_CNT
, 0 as T_SUCC_CNT
, 0 as T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS A_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS A_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS A_SUCC_RT
FROM hubez_common.EZ_MON_STAT
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')
AND SND_CH_CD = 'ALIMTALK'
GROUP BY SUM_YM
) T GROUP BY SUM_YM order by sumYm desc
</select> </select>
<select id="selectDayStatList" parameterType="kr.co.uplus.ez.api.stats.dto.DayListReqDto" resultType="kr.co.uplus.ez.api.stats.dto.DayList"> <select id="selectDayStatList" parameterType="kr.co.uplus.ez.api.stats.dto.DayListReqDto" resultType="kr.co.uplus.ez.api.stats.dto.DayList">
/* stats-mapper.xml(selectDayStatList) */ /* stats-mapper.xml(selectDayStatList) */
SELECT * FROM ( select '전체' AS sumYmd
SELECT , sum(T_SND_CNT) AS sndCnt
'전체' AS sumYmd , sum(T_SUCC_CNT) AS succCnt
, IFNULL(ecm1.SND_CNT,0) AS sndCnt , sum(T_SUCC_RT) AS succRt
, IFNULL(ecm1.SUCC_CNT,0) AS succCnt , sum(S_SND_CNT) AS sndCntS
, IFNULL(ecm1.SUCC_RT,0) AS succRt , sum(S_SUCC_CNT) AS succCntS
, IFNULL(S1.SND_CNT,0) AS sndCntS , sum(S_SUCC_RT) AS succRtS
, IFNULL(S1.SUCC_CNT,0) AS succCntS , sum(L_SND_CNT) AS sndCntL
, IFNULL(S1.SUCC_RT,0) AS succRtS , sum(L_SUCC_CNT) AS succCntL
, IFNULL(L1.SND_CNT,0) AS sndCntL , sum(L_SUCC_RT) AS succRtL
, IFNULL(L1.SUCC_CNT,0) AS succCntL , sum(M_SND_CNT) AS sndCntM
, IFNULL(L1.SUCC_RT,0) AS succRtL , sum(M_SUCC_CNT) AS succCntM
, IFNULL(M1.SND_CNT,0) AS sndCntM , sum(M_SUCC_RT) AS succRtM
, IFNULL(M1.SUCC_CNT,0) AS succCntM , sum(A_SND_CNT) AS sndCntR
, IFNULL(M1.SUCC_RT,0) AS succRtM , sum(A_SUCC_CNT) AS succCntR
, IFNULL(A1.SND_CNT,0) AS sndCntR , sum(A_SUCC_RT) AS succRtR
, IFNULL(A1.SUCC_CNT,0) AS succCntR from (
, IFNULL(A1.SUCC_RT,0) AS succRtR SELECT SUM(IFNULL(SND_CNT,0)) AS T_SND_CNT
FROM ,SUM(IFNULL(SUCC_CNT,0)) AS T_SUCC_CNT
(SELECT ,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS T_SUCC_RT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as S_SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , 0 as S_SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT , 0 as S_SUCC_RT
FROM , 0 as L_SND_CNT
hubez_common.EZ_DAY_STAT , 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1 WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d') AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
) ecm1, union all
( SELECT 0 as T_SND_CNT
SELECT , 0 as T_SUCC_CNT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as T_SUCC_RT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , SUM(IFNULL(SND_CNT,0)) AS S_SND_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT , SUM(IFNULL(SUCC_CNT,0)) AS S_SUCC_CNT
FROM , ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS S_SUCC_RT
hubez_common.EZ_DAY_STAT , 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1 WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d') AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'SMS' AND SND_CH_CD = 'SMS'
) S1, union all
( SELECT 0 as T_SND_CNT
SELECT , 0 as T_SUCC_CNT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as T_SUCC_RT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , 0 as S_SND_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT , 0 as S_SUCC_CNT
FROM , 0 as S_SUCC_RT
hubez_common.EZ_DAY_STAT , SUM(IFNULL(SND_CNT,0)) AS L_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS L_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1 WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d') AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'LMS' AND SND_CH_CD = 'LMS'
) L1, union all
( SELECT 0 as T_SND_CNT
SELECT , 0 as T_SUCC_CNT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as T_SUCC_RT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , 0 as S_SND_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT , 0 as S_SUCC_CNT
FROM , 0 as S_SUCC_RT
hubez_common.EZ_DAY_STAT , 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS M_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS M_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1 WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d') AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'MMS' AND SND_CH_CD = 'MMS'
) M1, union all
( SELECT 0 as T_SND_CNT
SELECT , 0 as T_SUCC_CNT
SUM(IFNULL(SND_CNT,0)) AS SND_CNT , 0 as T_SUCC_RT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT , 0 as S_SND_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100),2) AS SUCC_RT , 0 as S_SUCC_CNT
FROM , 0 as S_SUCC_RT
hubez_common.EZ_DAY_STAT , 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS A_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS A_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1 WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d') AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'ALIMTALK' AND SND_CH_CD = 'ALIMTALK'
) A1
UNION ALL
SELECT
DATE_FORMAT(ecm.SUM_YMD, '%Y-%m-%d') AS sumYmd
, ecm.SND_CNT AS sndCnt
, ecm.SUCC_CNT AS succCnt
, ecm.SUCC_RT AS succRt
, S.SND_CNT AS sndCntS
, S.SUCC_CNT AS succCntS
, S.SUCC_RT AS succRtS
, L.SND_CNT AS sndCntL
, L.SUCC_CNT AS succCntL
, L.SUCC_RT AS succRtL
, M.SND_CNT AS sndCntM
, M.SUCC_CNT AS succCntM
, M.SUCC_RT AS succRtM
, A.SND_CNT AS sndCntR
, A.SUCC_CNT AS succCntR
, A.SUCC_RT AS succRtR
FROM
(SELECT
SUM_YMD
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT
FROM
hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
GROUP BY SUM_YMD ) ecm,
(SELECT
SUM_YMD
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT
FROM
hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'SMS'
GROUP BY SUM_YMD ) S,
(SELECT
SUM_YMD
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT
FROM
hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'LMS'
GROUP BY SUM_YMD ) L,
( SELECT
SUM_YMD
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS SUCC_RT
FROM
hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'MMS'
GROUP BY SUM_YMD ) M,
( SELECT
SUM_YMD
,SUM(IFNULL(SND_CNT,0)) AS SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100),2) AS SUCC_RT
FROM
hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'ALIMTALK'
GROUP BY SUM_YMD ) A
WHERE 1=1
AND ecm.SUM_YMD = S.SUM_YMD
AND ecm.SUM_YMD = L.SUM_YMD
AND ecm.SUM_YMD = M.SUM_YMD
AND ecm.SUM_YMD = A.SUM_YMD
) T ) T
ORDER BY sumYmd DESC UNION ALL
select DATE_FORMAT(SUM_YMD, '%Y-%m-%d') AS sumYmd
, sum(T_SND_CNT) AS sndCnt
, sum(T_SUCC_CNT) AS succCnt
, sum(T_SUCC_RT) AS succRt
, sum(S_SND_CNT) AS sndCntS
, sum(S_SUCC_CNT) AS succCntS
, sum(S_SUCC_RT) AS succRtS
, sum(L_SND_CNT) AS sndCntL
, sum(L_SUCC_CNT) AS succCntL
, sum(L_SUCC_RT) AS succRtL
, sum(M_SND_CNT) AS sndCntM
, sum(M_SUCC_CNT) AS succCntM
, sum(M_SUCC_RT) AS succRtM
, sum(A_SND_CNT) AS sndCntR
, sum(A_SUCC_CNT) AS succCntR
, sum(A_SUCC_RT) AS succRtR
from (
SELECT SUM_YMD
, SUM(IFNULL(SND_CNT,0)) AS T_SND_CNT
,SUM(IFNULL(SUCC_CNT,0)) AS T_SUCC_CNT
,ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
GROUP BY SUM_YMD
union all
SELECT SUM_YMD
, 0 as T_SND_CNT
, 0 as T_SUCC_CNT
, 0 as T_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS S_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS S_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'SMS'
GROUP BY SUM_YMD
union all
SELECT SUM_YMD
, 0 as T_SND_CNT
, 0 as T_SUCC_CNT
, 0 as T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS L_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS L_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'LMS'
GROUP BY SUM_YMD
union all
SELECT SUM_YMD
, 0 as T_SND_CNT
, 0 as T_SUCC_CNT
, 0 as T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS M_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS M_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS M_SUCC_RT
, 0 as A_SND_CNT
, 0 as A_SUCC_CNT
, 0 as A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'MMS'
GROUP BY SUM_YMD
union all
SELECT SUM_YMD
, 0 as T_SND_CNT
, 0 as T_SUCC_CNT
, 0 as T_SUCC_RT
, 0 as S_SND_CNT
, 0 as S_SUCC_CNT
, 0 as S_SUCC_RT
, 0 as L_SND_CNT
, 0 as L_SUCC_CNT
, 0 as L_SUCC_RT
, 0 as M_SND_CNT
, 0 as M_SUCC_CNT
, 0 as M_SUCC_RT
, SUM(IFNULL(SND_CNT,0)) AS A_SND_CNT
, SUM(IFNULL(SUCC_CNT,0)) AS A_SUCC_CNT
, ROUND((SUM(IFNULL(SUCC_CNT,0)) / SUM(IFNULL(SND_CNT,0)) * 100), 2) AS A_SUCC_RT
FROM hubez_common.EZ_DAY_STAT
WHERE 1=1
AND SUM_YMD BETWEEN STR_TO_DATE(#{startDay},'%Y%m%d') AND STR_TO_DATE(#{endDay},'%Y%m%d')
AND SND_CH_CD = 'ALIMTALK'
GROUP BY SUM_YMD
) T GROUP BY SUM_YMD order by sumYmd desc
</select> </select>
<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">