refactor : 테이블 alias 변경

main
이범준 1 year ago
parent e7321dad9b
commit 7c0eaa6ba5

@ -6,50 +6,50 @@
* tb_crdn : 단속
************************************************************************************************************** -->
<sql id="sqlRtReglt">
SELECT trr.crdn_id
, trr.rtpyr_id -- 납부자ID
, trr.sgg_cd -- 기관코드
, trr.sys_se_cd -- 시스템코드
, trr.crdn_se_cd -- 단속구분코드
, trr.crdn_inpt_se_cd -- 입력구분코드
, trr.crdn_ymd
, trr.crdn_bgng_tm -- 단속시작시간
, trr.crdn_end_hr -- 단속종료시간
SELECT tc.crdn_id
, tc.rtpyr_id -- 납부자ID
, tc.sgg_cd -- 기관코드
, tc.sys_se_cd -- 시스템코드
, tc.crdn_se_cd -- 단속구분코드
, tc.crdn_inpt_se_cd -- 입력구분코드
, tc.crdn_ymd
, tc.crdn_bgng_tm -- 단속시작시간
, tc.crdn_end_hr -- 단속종료시간
, '' AS violt_lrg_code -- 위반 법규 코드
, '' AS violt_dtls_code -- 위반내역코드
, '' AS violt_dtls_etc_cn -- 위반내역 기타 내용
, trr.crdn_plc -- 위반장소
, trr.vltn_nmtm -- 위반횟수
, trr.crdn_stdg_nm -- 위반법정동명
, trr.gps_x
, trr.gps_y
, trr.towng_yn -- 견인여부 코드
, trr.crdn_sn -- 스티커 번호
, trr.atch_file_cnt -- 이미지매수
, trr.minus_amt -- 감경금액
, tc.crdn_plc -- 위반장소
, tc.vltn_nmtm -- 위반횟수
, tc.crdn_stdg_nm -- 위반법정동명
, tc.gps_x
, tc.gps_y
, tc.towng_yn -- 견인여부 코드
, tc.crdn_sn -- 스티커 번호
, tc.atch_file_cnt -- 이미지매수
, tc.minus_amt -- 감경금액
, 0 AS redution_aft_amount -- 감경후 금액
, trr.rcvmt_amt -- 수납금액
, tc.rcvmt_amt -- 수납금액
, 0 AS rdcamt -- 감액
, trr.adtn_amt -- 가산금
, trr.vhrno -- 차량번호
, trr.vhcl_nm -- 차량명
, trr.carmdl_clsf_nm -- 차종분류명
, trr.carmdl_asort_nm -- 차종종별명
, trr.ffnlg_carmdl_cd -- 과태료차종코드
, trr.vin -- 차대번호
, trr.etc_cn -- 특기사항
, trr.crdn_sparea_cd -- 단속특별구역코드
, trr.crdn_stts_cd
, trr.crdn_reg_se_cd -- 등록구분
, CONCAT(trr.crdn_ymd, trr.crdn_bgng_tm) AS crdnYmdTime
, trr.reg_dt
, teerc.file_link_id -- CCTV data ID : 접수번호로 보여줄 것
, tecs.cvlcpt_link_id
, tecs.cvlcpt_rcpt_no -- 접수번호
, tecs.cvlcpt_rcpt_ymd -- 접수일자
, tecs.cvlcpt_aplcnt_nm -- 신고자
, tecs.cvlcpt_prcs_prnmnt_dt -- 처리기한
, SUBSTR(tecs.cvlcpt_prcs_prnmnt_dt,1,8) AS cvlcpt_prcs_prnmnt_ymd
, tc.adtn_amt -- 가산금
, tc.vhrno -- 차량번호
, tc.vhcl_nm -- 차량명
, tc.carmdl_clsf_nm -- 차종분류명
, tc.carmdl_asort_nm -- 차종종별명
, tc.ffnlg_carmdl_cd -- 과태료차종코드
, tc.vin -- 차대번호
, tc.etc_cn -- 특기사항
, tc.crdn_sparea_cd -- 단속특별구역코드
, tc.crdn_stts_cd
, tc.crdn_reg_se_cd -- 등록구분
, CONCAT(tc.crdn_ymd, tc.crdn_bgng_tm) AS crdnYmdTime
, tc.reg_dt
, tcfl.file_link_id -- CCTV data ID : 접수번호로 보여줄 것
, tcc.cvlcpt_link_id
, tcc.cvlcpt_rcpt_no -- 접수번호
, tcc.cvlcpt_rcpt_ymd -- 접수일자
, tcc.cvlcpt_aplcnt_nm -- 신고자
, tcc.cvlcpt_prcs_prnmnt_dt -- 처리기한
, SUBSTR(tcc.cvlcpt_prcs_prnmnt_dt,1,8) AS cvlcpt_prcs_prnmnt_ymd
, tei.duty_id_v -- 담당자
, tei.pcd_tel_v -- 담당자 전화번호
, tre.erpp_id
@ -60,37 +60,37 @@
, trp.addr
, trp.dtl_addr
, trp.stdg_cd -- 법정동 코드
, IF(trr.crdn_se_cd = '09', '', teerc.vltn_cn) AS vltnCn -- 위반내용
, IF(tc.crdn_se_cd = '09', '', tcfl.vltn_cn) AS vltnCn -- 위반내용
, (SELECT COUNT(crdn_id)
FROM tb_crdn tgt
WHERE tgt.vhrno = trr.vhrno
AND NOT NULLIF(trr.vhrno, '') IS NULL) AS vhrnoCnt
WHERE tgt.vhrno = tc.vhrno
AND NOT NULLIF(tc.vhrno, '') IS NULL) AS vhrnoCnt
, (SELECT COUNT(cvlcpt_dscsn_id)
FROM tb_cvlcpt_dscsn_cn tgt
WHERE EXISTS(SELECT 1
FROM tb_crdn
WHERE tgt.crdn_id = crdn_id
AND NOT NULLIF(rtpyr_id, '') IS NULL
AND rtpyr_id = trr.rtpyr_id
AND rtpyr_id = tc.rtpyr_id
)
OR (
NOT NULLIF(trr.vhrno, '') IS NULL
AND tgt.vhrno = trr.vhrno
NOT NULLIF(tc.vhrno, '') IS NULL
AND tgt.vhrno = tc.vhrno
)
) AS minwonCnt
, trr.mdfcn_dt -- 최종처리일시
, trr.mdfr -- 최종 처리자
FROM tb_crdn trr
LEFT JOIN tb_crdn_file_link teerc
ON trr.link_id = teerc.file_link_id
LEFT JOIN tb_crdn_cvlcpt tecs
ON trr.link_id = tecs.cvlcpt_link_id
, tc.mdfcn_dt -- 최종처리일시
, tc.mdfr -- 최종 처리자
FROM tb_crdn tc
LEFT JOIN tb_crdn_file_link tcfl
ON tc.link_id = tcfl.file_link_id
LEFT JOIN tb_crdn_cvlcpt tcc
ON tc.link_id = tcc.cvlcpt_link_id
LEFT JOIN tb_esb_interface tei
ON trr.link_id = tei.interface_seq_n
ON tc.link_id = tei.interface_seq_n
LEFT JOIN tb_rt_erpp tre
ON trr.crdn_id = tre.crdn_id
ON tc.crdn_id = tre.crdn_id
LEFT JOIN tb_payer trp
ON trr.rtpyr_id = trp.rtpyr_id
ON tc.rtpyr_id = trp.rtpyr_id
</sql>
@ -102,46 +102,46 @@
<if test='crdnSttsCd eq "NON-INIT"'>
<if test='ctznAnsYn eq "Y"'>
AND trr.crdn_stts_cd != '01'
AND tc.crdn_stts_cd != '01'
</if>
<if test='ctznAnsYn eq "N"'>
</if>
</if>
<if test='crdnSttsCd != "NON-INIT"'>
AND trr.crdn_stts_cd = #{crdnSttsCd}
AND tc.crdn_stts_cd = #{crdnSttsCd}
</if>
</if>
<if test='sch_date_opt eq "crdnYmd"'>
AND trr.crdn_ymd BETWEEN REPLACE(#{sch_date_from},'-','') AND REPLACE(#{sch_date_to},'-','')
AND tc.crdn_ymd BETWEEN REPLACE(#{sch_date_from},'-','') AND REPLACE(#{sch_date_to},'-','')
</if>
<if test='sch_date_opt eq "regDt"'>
AND SUBSTR(trr.reg_dt,1,8) BETWEEN REPLACE(#{sch_date_from},'-','') AND REPLACE(#{sch_date_to},'-','')
AND SUBSTR(tc.reg_dt,1,8) BETWEEN REPLACE(#{sch_date_from},'-','') AND REPLACE(#{sch_date_to},'-','')
</if>
<if test='vhrno != null and vhrno != ""'>
AND INSTR(trr.vhrno, #{vhrno}) > 0
AND INSTR(tc.vhrno, #{vhrno}) > 0
</if>
<if test='sysSeCd != null and sysSeCd != ""'>
AND trr.sys_se_cd = #{sysSeCd}
AND tc.sys_se_cd = #{sysSeCd}
</if>
<if test='crdnSeCd != null and crdnSeCd != ""'>
AND trr.crdn_se_cd = #{crdnSeCd}
AND tc.crdn_se_cd = #{crdnSeCd}
</if>
<if test='crdnRegSeCd != null and crdnRegSeCd != ""'>
AND trr.crdn_reg_se_cd = #{crdnRegSeCd}
AND tc.crdn_reg_se_cd = #{crdnRegSeCd}
</if>
</where>
ORDER BY trr.sys_se_cd, trr.crdn_se_cd
, teerc.file_link_id
, trr.link_id
, trr.crdn_ymd, trr.vhrno, trr.crdn_bgng_tm
ORDER BY tc.sys_se_cd, tc.crdn_se_cd
, tcfl.file_link_id
, tc.link_id
, tc.crdn_ymd, tc.vhrno, tc.crdn_bgng_tm
</select>
<select id="selectCrackdown" resultType="kr.xit.fims.biz.cmm.FimsCrackdownDTO$Info">
/* cmm-fims-crackdown-mysql-mapper|selectCrackdown-단속 정보 조회|julim */
<include refid="sqlRtReglt"/>
WHERE trr.crdn_id = #{crdnId}
WHERE tc.crdn_id = #{crdnId}
</select>
<select id="selectCtznStmtInfo" resultType="kr.xit.fims.biz.cmm.FimsCrackdownDTO$Ctzn">
@ -408,37 +408,37 @@
<select id="selectCrackdownVhrnoCnt" resultType="int">
/* cmm-fims-crackdown-mysql-mapper|selectCrackdownVhrnoCnt-단속횟수 조회|julim */
SELECT COUNT(crdn_id)
FROM tb_crdn trr
WHERE trr.vhrno = #{vhrno}
FROM tb_crdn tc
WHERE tc.vhrno = #{vhrno}
AND NOT NULLIF(#{vhvle_no}, '') IS NULL
</select>
<select id="selectCrackdownPhotoLayout" resultType="kr.xit.fims.biz.cmm.NtriDTO$CrackdownPhotoLayout">
/* cmm-fims-crackdown-mysql-mapper|selectCrackdownPhotoLayout-주정차/전용차로 단속사진전송 정보 레이아웃 조회|julim */
SELECT CONCAT(trr.crdn_ymd, trr.crdn_bgng_tm) AS crdnYmdTime -- 단속일시
, trr.vhrno -- 차량번호
, trr.crdn_se_cd -- 단속구분코드
, teerc.crdn_eqpmnt_no -- 단속장비관리번호
SELECT CONCAT(tc.crdn_ymd, tc.crdn_bgng_tm) AS crdnYmdTime -- 단속일시
, tc.vhrno -- 차량번호
, tc.crdn_se_cd -- 단속구분코드
, tcfl.crdn_eqpmnt_no -- 단속장비관리번호
, '' AS violt_dtls_code -- 위반내역코드
, '' AS violt_dtls_etc_cn -- 위반내역기타내용
, '' AS violt_lrg_code -- 위반법규(?? 60자리)
, trr.crdn_plc -- 위반장소
, trr.crdn_sparea_cd -- 단속특별구역구분
, tc.crdn_plc -- 위반장소
, tc.crdn_sparea_cd -- 단속특별구역구분
, '1' AS regionSe -- 지역구분
, CASE WHEN NULLIF(trr.crdn_stdg_nm, '') IS NULL
, CASE WHEN NULLIF(tc.crdn_stdg_nm, '') IS NULL
THEN '0000000000'
ELSE trr.crdn_stdg_nm
ELSE tc.crdn_stdg_nm
END AS crdnStdgCd -- 지역코드
, trr.gps_x
, trr.gps_y
, tc.gps_x
, tc.gps_y
, '' AS vhclNoX -- 자동차등록번호판위치 X축
, '' AS vhrnoY -- 자동차등록번호판위치 Y축
, trr.atch_file_cnt -- 사진갯수
, tc.atch_file_cnt -- 사진갯수
, 'jpg' AS fileExtsn -- 확장자
FROM tb_crdn trr
JOIN tb_crdn_file_link teerc
ON trr.link_id = teerc.file_link_id
WHERE trr.crdn_id = #{crdnId}
FROM tb_crdn tc
JOIN tb_crdn_file_link tcfl
ON tc.link_id = tcfl.file_link_id
WHERE tc.crdn_id = #{crdnId}
</select>
</mapper>

@ -104,7 +104,7 @@
<include refid="sqlEcCtznStmtDtl"/>
<where>
<if test='interfaceSeqN != null and interfaceSeqN != ""'>
AND tecs.cvlcpt_link_id = #{cvlcptLinkId}
AND tcc.cvlcpt_link_id = #{cvlcptLinkId}
</if>
<if test='crdnId != null and crdnId != ""'>
AND tc.crdn_id = #{crdnId}

@ -7,52 +7,52 @@
* tb_crdn : 단속
************************************************************************************************************** -->
<sql id="sqlRtReglt">
SELECT trr.crdn_id
, trr.rtpyr_id -- 납부자ID
, trr.sgg_cd -- 기관코드
, trr.sys_se_cd -- 시스템코드
, trr.crdn_se_cd -- 단속구분코드
, trr.crdn_inpt_se_cd -- 입력구분코드
, trr.crdn_ymd
, trr.crdn_bgng_tm -- 단속시작시간
, trr.crdn_end_hr -- 단속종료시간
SELECT tc.crdn_id
, tc.rtpyr_id -- 납부자ID
, tc.sgg_cd -- 기관코드
, tc.sys_se_cd -- 시스템코드
, tc.crdn_se_cd -- 단속구분코드
, tc.crdn_inpt_se_cd -- 입력구분코드
, tc.crdn_ymd
, tc.crdn_bgng_tm -- 단속시작시간
, tc.crdn_end_hr -- 단속종료시간
, '' AS violt_lrg_code -- 위반 법규 코드
, '' AS violt_dtls_code -- 위반내역코드
, '' AS violt_dtls_etc_cn -- 위반내역 기타 내용
, trr.crdn_plc -- 위반장소
, trr.vltn_nmtm -- 위반횟수
, trr.crdn_stdg_nm -- 위반법정코드
, trr.gps_x
, trr.gps_y
, trr.towng_yn -- 견인여부 코드
, trr.crdn_sn -- 스티커 번호
, trr.atch_file_cnt -- 이미지매수
, trr.minus_amt -- 감경금액
, tc.crdn_plc -- 위반장소
, tc.vltn_nmtm -- 위반횟수
, tc.crdn_stdg_nm -- 위반법정코드
, tc.gps_x
, tc.gps_y
, tc.towng_yn -- 견인여부 코드
, tc.crdn_sn -- 스티커 번호
, tc.atch_file_cnt -- 이미지매수
, tc.minus_amt -- 감경금액
, 0 AS redution_aft_amount -- 감경후 금액
, trr.rcvmt_amt -- 수납금액
, tc.rcvmt_amt -- 수납금액
, 0 AS rdcamt -- 감액
, trr.adtn_amt -- 가산금
, trr.vhrno -- 차량번호
, trr.vhcl_nm -- 차량명
, trr.carmdl_clsf_nm -- 차종분류명
, trr.carmdl_asort_nm -- 차종종별명
, trr.ffnlg_carmdl_cd -- 과태료차종코드
, trr.vin -- 차대번호
, trr.etc_cn -- 특기사항
, trr.crdn_sparea_cd -- 단속특별구역코드
, trr.crdn_stts_cd
, trr.crdn_reg_se_cd
, CONCAT(trr.crdn_ymd, trr.crdn_bgng_tm) AS crdnYmdTime
, trr.reg_dt
, trr.rgtr
, trr.mdfcn_dt
, trr.mdfr
FROM tb_crdn trr
, tc.adtn_amt -- 가산금
, tc.vhrno -- 차량번호
, tc.vhcl_nm -- 차량명
, tc.carmdl_clsf_nm -- 차종분류명
, tc.carmdl_asort_nm -- 차종종별명
, tc.ffnlg_carmdl_cd -- 과태료차종코드
, tc.vin -- 차대번호
, tc.etc_cn -- 특기사항
, tc.crdn_sparea_cd -- 단속특별구역코드
, tc.crdn_stts_cd
, tc.crdn_reg_se_cd
, CONCAT(tc.crdn_ymd, tc.crdn_bgng_tm) AS crdnYmdTime
, tc.reg_dt
, tc.rgtr
, tc.mdfcn_dt
, tc.mdfr
FROM tb_crdn tc
</sql>
<!--
/* TODO : 차적조회를 안하고 바로 자료 전송 하여 rtpyr를 알수 없음
JOIN tb_payer trp
ON trr.rtpyr_id = trp.rtpyr_id
ON tc.rtpyr_id = trp.rtpyr_id
*/
-->
@ -62,46 +62,46 @@
<include refid="sqlRtReglt"/>
<where>
<if test='sch_date_opt eq "crdnYmd"'>
AND trr.crdn_ymd BETWEEN REPLACE(#{sch_date_from},'-','') AND REPLACE(#{sch_date_to},'-','')
AND tc.crdn_ymd BETWEEN REPLACE(#{sch_date_from},'-','') AND REPLACE(#{sch_date_to},'-','')
</if>
<if test='sch_date_opt eq "regDt"'>
AND SUBSTR(trr.reg_dt,1,8) BETWEEN REPLACE(#{sch_date_from},'-','') AND REPLACE(#{sch_date_to},'-','')
AND SUBSTR(tc.reg_dt,1,8) BETWEEN REPLACE(#{sch_date_from},'-','') AND REPLACE(#{sch_date_to},'-','')
</if>
<if test='vhrno != null and vhrno != ""'>
AND INSTR(trr.vhrno, #{vhrno}) > 0
AND INSTR(tc.vhrno, #{vhrno}) > 0
</if>
<if test='sysSeCd != null and sysSeCd != ""'>
AND trr.sys_se_cd = #{sysSeCd}
AND tc.sys_se_cd = #{sysSeCd}
</if>
<if test='crdnSeCd != null and crdnSeCd != ""'>
AND trr.crdn_se_cd = #{crdnSeCd}
AND tc.crdn_se_cd = #{crdnSeCd}
</if>
<if test='crdnRegSeCd != null and crdnRegSeCd != ""'>
AND trr.crdn_reg_se_cd = #{crdnRegSeCd}
AND tc.crdn_reg_se_cd = #{crdnRegSeCd}
</if>
<if test='cnfmYn != null and cnfmYn != ""'>
<if test='cnfmYn eq "Y"'>
AND LENGTH(IFNULL(trr.ffnlg_carmdl_cd, '')) > 0
AND LENGTH(IFNULL(tc.ffnlg_carmdl_cd, '')) > 0
</if>
<if test='cnfmYn eq "N"'>
AND LENGTH(IFNULL(trr.ffnlg_carmdl_cd, '')) = 0
AND LENGTH(IFNULL(tc.ffnlg_carmdl_cd, '')) = 0
</if>
</if>
</where>
ORDER BY trr.sys_se_cd, trr.crdn_se_cd, trr.crdn_ymd, trr.vhrno, trr.crdn_bgng_tm
ORDER BY tc.sys_se_cd, tc.crdn_se_cd, tc.crdn_ymd, tc.vhrno, tc.crdn_bgng_tm
</select>
<select id="selectRtReglt" resultType="kr.xit.fims.biz.rt.RtDTO$Reglt">
/* rt-reglt-and-erpp-mysql-mapper|selectRtReglt-단속 정보 조회|julim */
<include refid="sqlRtReglt"/>
WHERE trr.crdn_id = #{crdnId}
WHERE tc.crdn_id = #{crdnId}
</select>
<select id="selectRtRegltByVhrno" resultType="kr.xit.fims.biz.rt.RtDTO$Reglt">
/* rt-reglt-and-erpp-mysql-mapper|selectRtRegltByVhrno-차량 단속 정보 목록 조회|julim */
<include refid="sqlRtReglt"/>
WHERE trr.vhrno = #{vhrno}
ORDER BY trr.crdn_ymd DESC, trr.crdn_bgng_tm DESC
WHERE tc.vhrno = #{vhrno}
ORDER BY tc.crdn_ymd DESC, tc.crdn_bgng_tm DESC
</select>
<insert id="insertRtReglt">
@ -280,7 +280,7 @@
, stdg_cd
, dong_cd
, mtn_se_cd
, mso
, mno
, sno
, spcl_dong
, spcl_ho

Loading…
Cancel
Save