청약목록 조회 쿼리 수정

This commit is contained in:
kimre
2022-07-15 16:47:25 +09:00
parent 34e7957081
commit 71415bac5b

View File

@@ -17,6 +17,8 @@
ON
eci.CUST_SEQ = esi.CUST_SEQ
AND esi.CUST_SEQ = esu.CUST_SEQ
LEFT JOIN hubez_imdb.EZ_IM_USER eiu
on eiu.LOGIN_ID = esi.ATTRCTOR_ID
WHERE 1 = 1
<include refid="subsListCondition"/>
</select>
@@ -38,26 +40,23 @@
GRP_CD = 'SUBS_STTUS_CD'
AND DTL_CD = A.SUBS_STTUS_CD
) AS STAT
, ifnull((
select case when EX_PROVUSERTYPE in ( 'CCS-CS1'
, 'CCS-CB1'
, 'CCS-CB2'
, 'CCS-CJ'
, 'CCS-LS2'
, 'CCS-LS3'
, 'CCS-M'
, 'CCS-MJ'
, 'CCS-P'
, 'CCS-P2'
, 'CCS-D'
, 'CCS-G'
, 'CCS-S') then '고객센터'
when EX_PROVUSERTYPE = 'DEALER' then '대리점'
else '직접영업'
end as ATTRACT_CHANNEL
from hubez_imdb.EZ_IM_USER
where LOGIN_ID = A.attrctorId
) , '고객셀프가입') as CHANNEL
, case when A.EX_PROVUSERTYPE in ( 'CCS-CS1'
, 'CCS-CB1'
, 'CCS-CB2'
, 'CCS-CJ'
, 'CCS-LS2'
, 'CCS-LS3'
, 'CCS-M'
, 'CCS-MJ'
, 'CCS-P'
, 'CCS-P2'
, 'CCS-D'
, 'CCS-G'
, 'CCS-S') then '고객센터'
when A.EX_PROVUSERTYPE = 'DEALER' then '대리점'
when A.EX_PROVUSERTYPE is null then '고객셀프가입'
else '직접영업'
end as CHANNEL
, (
SELECT
PROD_NM
@@ -77,16 +76,18 @@
esi.SUBS_STTUS_CD ,
esi.PROD_CD,
esi.USER_SEQ as adminSeq,
esi.ATTRCTOR_ID as attrctorId
esi.ATTRCTOR_ID as attrctorId ,
eiu.EX_PROVUSERTYPE
FROM
hubez_common.EZ_SUBS_INFO esi
INNER JOIN hubez_common.EZ_SVC_USER esu
ON esu.USER_SEQ = esi.USER_SEQ
and esu.USER_TP_CD in ('01','03')
INNER JOIN hubez_common.EZ_CUST_INFO eci
ON
eci.CUST_SEQ = esi.CUST_SEQ
ON eci.CUST_SEQ = esi.CUST_SEQ
AND esi.CUST_SEQ = esu.CUST_SEQ
LEFT JOIN hubez_imdb.EZ_IM_USER eiu
on eiu.LOGIN_ID = esi.ATTRCTOR_ID
WHERE 1 = 1
<include refid="subsListCondition"/>
ORDER BY esi.OPN_DT DESC
@@ -159,6 +160,8 @@
ON
eci.CUST_SEQ = esi.CUST_SEQ
AND esi.CUST_SEQ = esu.CUST_SEQ
LEFT JOIN hubez_imdb.EZ_IM_USER eiu
on eiu.LOGIN_ID = esi.ATTRCTOR_ID
WHERE 1 = 1
<include refid="subsListCondition"/>
ORDER BY esi.OPN_DT DESC ) A, ( SELECT @ROWNUM := 0 ) AS R
@@ -174,7 +177,42 @@
AND esu.USER_STTUS_CD = #{searchType1}
</if>
<if test="searchType2 != null and searchType2 != ''">
AND esu.USER_TP_CD = #{searchType2}
<if test="searchType2 == '01'">
AND eiu.EX_PROVUSERTYPE is null
</if>
<if test="searchType2 == '02' ">
AND eiu.EX_PROVUSERTYPE = 'DEALER'
</if>
<if test="searchType2 == '03' ">
AND eiu.EX_PROVUSERTYPE in ( 'CCS-CS1'
, 'CCS-CB1'
, 'CCS-CB2'
, 'CCS-CJ'
, 'CCS-LS2'
, 'CCS-LS3'
, 'CCS-M'
, 'CCS-MJ'
, 'CCS-P'
, 'CCS-P2'
, 'CCS-D'
, 'CCS-G'
, 'CCS-S')
</if>
<if test="searchType2 == '04' ">
AND eiu.EX_PROVUSERTYPE not in ( 'CCS-CS1'
, 'CCS-CB1'
, 'CCS-CB2'
, 'CCS-CJ'
, 'CCS-LS2'
, 'CCS-LS3'
, 'CCS-M'
, 'CCS-MJ'
, 'CCS-P'
, 'CCS-P2'
, 'CCS-D'
, 'CCS-G'
, 'CCS-S', 'DEALER')
</if>
</if>
<if test="searchType3 != null and searchType3 != ''">
<if test="searchType3 == '01' and searchText1 != null and searchText1 != ''">