|
|
@ -19,15 +19,15 @@
|
|
|
|
, IF(tpi.prtm_se_nm = '비마약류', 1, 0) AS 비마약류
|
|
|
|
, IF(tpi.prtm_se_nm = '비마약류', 1, 0) AS 비마약류
|
|
|
|
, IF(tpi.prtm_se_nm = '일반관리대상', 1, 0) AS 일반관리대상
|
|
|
|
, IF(tpi.prtm_se_nm = '일반관리대상', 1, 0) AS 일반관리대상
|
|
|
|
, IF(tpi.prtm_se_nm = '중점관리대상', 1, 0) AS 중점관리대상
|
|
|
|
, IF(tpi.prtm_se_nm = '중점관리대상', 1, 0) AS 중점관리대상
|
|
|
|
, IF(tpi.nrcd_se_nm = '대마', tdmd.dsuse_qy, '0') AS 대마qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '대마', tdmd.dsuse_qy, '0') AS 대마Qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '마약', tdmd.dsuse_qy, '0') AS 마약qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '마약', tdmd.dsuse_qy, '0') AS 마약Qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '한외마약', tdmd.dsuse_qy, '0') AS 한외마약qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '한외마약', tdmd.dsuse_qy, '0') AS 한외마약Qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '향정', tdmd.dsuse_qy, '0') AS 향정qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '향정', tdmd.dsuse_qy, '0') AS 향정Qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '향정제외', tdmd.dsuse_qy, '0') AS 향정제외qy
|
|
|
|
, IF(tpi.nrcd_se_nm = '향정제외', tdmd.dsuse_qy, '0') AS 향정제외Qy
|
|
|
|
, IF(tpi.nrcd_se_nm IS NULL, tdmd.dsuse_qy, '0') AS 기타qy
|
|
|
|
, IF(tpi.nrcd_se_nm IS NULL, tdmd.dsuse_qy, '0') AS 기타Qy
|
|
|
|
, IF(tpi.prtm_se_nm = '비마약류', tdmd.dsuse_qy, 0) AS 비마약류qy
|
|
|
|
, IF(tpi.prtm_se_nm = '비마약류', tdmd.dsuse_qy, 0) AS 비마약류Qy
|
|
|
|
, IF(tpi.prtm_se_nm = '일반관리대상', tdmd.dsuse_qy, 0) AS 일반관리대상qy
|
|
|
|
, IF(tpi.prtm_se_nm = '일반관리대상', tdmd.dsuse_qy, 0) AS 일반관리대상Qy
|
|
|
|
, IF(tpi.prtm_se_nm = '중점관리대상', tdmd.dsuse_qy, 0) AS 중점관리대상qy
|
|
|
|
, IF(tpi.prtm_se_nm = '중점관리대상', tdmd.dsuse_qy, 0) AS 중점관리대상Qy
|
|
|
|
FROM tb_dsuse_mgt tdm
|
|
|
|
FROM tb_dsuse_mgt tdm
|
|
|
|
JOIN tb_dsuse_mgt_dtl tdmd ON tdm.dscdmng_id = tdmd.dscdmng_id
|
|
|
|
JOIN tb_dsuse_mgt_dtl tdmd ON tdm.dscdmng_id = tdmd.dscdmng_id
|
|
|
|
JOIN tb_prduct_info tpi ON tdmd.prduct_cd = tpi.prduct_cd
|
|
|
|
JOIN tb_prduct_info tpi ON tdmd.prduct_cd = tpi.prduct_cd
|
|
|
@ -61,15 +61,15 @@
|
|
|
|
, SUM(tgt.비마약류) AS 비마약류
|
|
|
|
, SUM(tgt.비마약류) AS 비마약류
|
|
|
|
, SUM(tgt.일반관리대상) AS 일반관리대상
|
|
|
|
, SUM(tgt.일반관리대상) AS 일반관리대상
|
|
|
|
, SUM(tgt.중점관리대상) AS 중점관리대상
|
|
|
|
, SUM(tgt.중점관리대상) AS 중점관리대상
|
|
|
|
, SUM(tgt.대마qy) AS 대마qy
|
|
|
|
, SUM(tgt.대마Qy) AS 대마Qy
|
|
|
|
, SUM(tgt.마약qy) AS 마약qy
|
|
|
|
, SUM(tgt.마약Qy) AS 마약Qy
|
|
|
|
, SUM(tgt.한외마약qy) AS 한외마약qy
|
|
|
|
, SUM(tgt.한외마약Qy) AS 한외마약Qy
|
|
|
|
, SUM(tgt.향정qy) AS 향정qy
|
|
|
|
, SUM(tgt.향정Qy) AS 향정Qy
|
|
|
|
, SUM(tgt.향정제외qy) AS 향정제외qy
|
|
|
|
, SUM(tgt.향정제외Qy) AS 향정제외Qy
|
|
|
|
, SUM(tgt.기타qy) AS 기타qy
|
|
|
|
, SUM(tgt.기타Qy) AS 기타Qy
|
|
|
|
, SUM(tgt.비마약류qy) AS 비마약류qy
|
|
|
|
, SUM(tgt.비마약류Qy) AS 비마약류Qy
|
|
|
|
, SUM(tgt.일반관리대상qy) AS 일반관리대상qy
|
|
|
|
, SUM(tgt.일반관리대상Qy) AS 일반관리대상Qy
|
|
|
|
, SUM(tgt.중점관리대상qy) AS 중점관리대상qy
|
|
|
|
, SUM(tgt.중점관리대상Qy) AS 중점관리대상Qy
|
|
|
|
FROM tgt
|
|
|
|
FROM tgt
|
|
|
|
GROUP BY tgt.dept_cd
|
|
|
|
GROUP BY tgt.dept_cd
|
|
|
|
UNION ALL
|
|
|
|
UNION ALL
|
|
|
@ -85,15 +85,15 @@
|
|
|
|
, SUM(tgt.비마약류) AS 비마약류
|
|
|
|
, SUM(tgt.비마약류) AS 비마약류
|
|
|
|
, SUM(tgt.일반관리대상) AS 일반관리대상
|
|
|
|
, SUM(tgt.일반관리대상) AS 일반관리대상
|
|
|
|
, SUM(tgt.중점관리대상) AS 중점관리대상
|
|
|
|
, SUM(tgt.중점관리대상) AS 중점관리대상
|
|
|
|
, SUM(tgt.대마qy) AS 대마qy
|
|
|
|
, SUM(tgt.대마Qy) AS 대마Qy
|
|
|
|
, SUM(tgt.마약qy) AS 마약qy
|
|
|
|
, SUM(tgt.마약Qy) AS 마약Qy
|
|
|
|
, SUM(tgt.한외마약qy) AS 한외마약qy
|
|
|
|
, SUM(tgt.한외마약Qy) AS 한외마약Qy
|
|
|
|
, SUM(tgt.향정qy) AS 향정qy
|
|
|
|
, SUM(tgt.향정Qy) AS 향정Qy
|
|
|
|
, SUM(tgt.향정제외qy) AS 향정제외qy
|
|
|
|
, SUM(tgt.향정제외Qy) AS 향정제외Qy
|
|
|
|
, SUM(tgt.기타qy) AS 기타qy
|
|
|
|
, SUM(tgt.기타Qy) AS 기타Qy
|
|
|
|
, SUM(tgt.비마약류qy) AS 비마약류qy
|
|
|
|
, SUM(tgt.비마약류Qy) AS 비마약류Qy
|
|
|
|
, SUM(tgt.일반관리대상qy) AS 일반관리대상qy
|
|
|
|
, SUM(tgt.일반관리대상Qy) AS 일반관리대상Qy
|
|
|
|
, SUM(tgt.중점관리대상qy) AS 중점관리대상qy
|
|
|
|
, SUM(tgt.중점관리대상Qy) AS 중점관리대상Qy
|
|
|
|
FROM tgt
|
|
|
|
FROM tgt
|
|
|
|
) T
|
|
|
|
) T
|
|
|
|
LEFT JOIN tb_dept td
|
|
|
|
LEFT JOIN tb_dept td
|
|
|
@ -129,22 +129,22 @@
|
|
|
|
AND tdm.dsuse_mth_cd = tcc.code)
|
|
|
|
AND tdm.dsuse_mth_cd = tcc.code)
|
|
|
|
WHERE tdm.use_yn = 'Y'
|
|
|
|
WHERE tdm.use_yn = 'Y'
|
|
|
|
<if test="deptCd != null and deptCd != ''">
|
|
|
|
<if test="deptCd != null and deptCd != ''">
|
|
|
|
AND tdm.dept_cd = #{deptCd} <!-- 관할 관청 -->
|
|
|
|
AND tdm.dept_cd = #{deptCd} <!-- 관할 관청 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schDateFrom != null">
|
|
|
|
<if test="schDateFrom != null">
|
|
|
|
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
|
|
|
|
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schDateTo != null">
|
|
|
|
<if test="schDateTo != null">
|
|
|
|
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
|
|
|
|
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schSttsCd != null">
|
|
|
|
<if test="schSttsCd != null">
|
|
|
|
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
|
|
|
|
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="nrcdSeNm != null">
|
|
|
|
<if test="nrcdSeNm != null">
|
|
|
|
AND tpi.nrcd_se_nm = #{nrcdSeNm} <!-- 진행 상태 -->
|
|
|
|
AND tpi.nrcd_se_nm = #{nrcdSeNm} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="prtmSeNm != null">
|
|
|
|
<if test="prtmSeNm != null">
|
|
|
|
AND tpi.prtm_se_nm = #{prtmSeNm} <!-- 진행 상태 -->
|
|
|
|
AND tpi.prtm_se_nm = #{prtmSeNm} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
@ -225,49 +225,49 @@
|
|
|
|
<select id="selectDsuseMgtDsuseQyByPrdStatisticsDtls" parameterType="map" resultType="dataobject">
|
|
|
|
<select id="selectDsuseMgtDsuseQyByPrdStatisticsDtls" parameterType="map" resultType="dataobject">
|
|
|
|
/* 제품별 폐기 현황 상세 목록 */
|
|
|
|
/* 제품별 폐기 현황 상세 목록 */
|
|
|
|
SELECT ROW_NUMBER() over (ORDER BY tdm.dept_cd, tdm.dsuse_de DESC, tdm.dsuse_mth_cd) AS ROW_NUM
|
|
|
|
SELECT ROW_NUMBER() over (ORDER BY tdm.dept_cd, tdm.dsuse_de DESC, tdm.dsuse_mth_cd) AS ROW_NUM
|
|
|
|
, tdm.dept_cd
|
|
|
|
, tdm.dept_cd
|
|
|
|
, td.dept_nm
|
|
|
|
, td.dept_nm
|
|
|
|
, tdm.dsuse_de
|
|
|
|
, tdm.dsuse_de
|
|
|
|
, tcc.code_val AS prgrs_stts_nm
|
|
|
|
, tcc.code_val AS prgrs_stts_nm
|
|
|
|
, tcc2.code_val AS dsuse_mth_nm
|
|
|
|
, tcc2.code_val AS dsuse_mth_nm
|
|
|
|
, tbi.bssh_nm
|
|
|
|
, tbi.bssh_nm
|
|
|
|
, tbi.rprsntv_nm
|
|
|
|
, tbi.rprsntv_nm
|
|
|
|
, tdm.dscdmng_id
|
|
|
|
, tdm.dscdmng_id
|
|
|
|
, tdm.rnd_dtl_rpt_cnt
|
|
|
|
, tdm.rnd_dtl_rpt_cnt
|
|
|
|
, tdmd.prduct_cd
|
|
|
|
, tdmd.prduct_cd
|
|
|
|
, tpi.prduct_nm
|
|
|
|
, tpi.prduct_nm
|
|
|
|
, tdmd.dsuse_qy
|
|
|
|
, tdmd.dsuse_qy
|
|
|
|
FROM tb_dsuse_mgt tdm
|
|
|
|
FROM tb_dsuse_mgt tdm
|
|
|
|
JOIN tb_dsuse_mgt_dtl tdmd
|
|
|
|
JOIN tb_dsuse_mgt_dtl tdmd
|
|
|
|
ON tdm.dscdmng_id = tdmd.dscdmng_id
|
|
|
|
ON tdm.dscdmng_id = tdmd.dscdmng_id
|
|
|
|
JOIN tb_prduct_info tpi
|
|
|
|
JOIN tb_prduct_info tpi
|
|
|
|
ON tdmd.prduct_cd = tpi.prduct_cd
|
|
|
|
ON tdmd.prduct_cd = tpi.prduct_cd
|
|
|
|
JOIN tb_dept td
|
|
|
|
JOIN tb_dept td
|
|
|
|
ON tdm.dept_cd = td.dept_cd
|
|
|
|
ON tdm.dept_cd = td.dept_cd
|
|
|
|
JOIN tb_bssh_info tbi
|
|
|
|
JOIN tb_bssh_info tbi
|
|
|
|
ON tdm.bssh_cd = tbi.bssh_cd
|
|
|
|
ON tdm.bssh_cd = tbi.bssh_cd
|
|
|
|
LEFT JOIN tb_cmn_code tcc
|
|
|
|
LEFT JOIN tb_cmn_code tcc
|
|
|
|
ON (tcc.grp_id = 'ADDS11'
|
|
|
|
ON (tcc.grp_id = 'ADDS11'
|
|
|
|
AND tdm.prgrs_stts_cd = tcc.code)
|
|
|
|
AND tdm.prgrs_stts_cd = tcc.code)
|
|
|
|
LEFT JOIN tb_cmn_code tcc2
|
|
|
|
LEFT JOIN tb_cmn_code tcc2
|
|
|
|
ON (tcc2.grp_id = 'ADDS05'
|
|
|
|
ON (tcc2.grp_id = 'ADDS05'
|
|
|
|
AND tdm.dsuse_mth_cd = tcc2.code)
|
|
|
|
AND tdm.dsuse_mth_cd = tcc2.code)
|
|
|
|
WHERE tdm.use_yn = 'Y'
|
|
|
|
WHERE tdm.use_yn = 'Y'
|
|
|
|
AND tpi.prduct_cd = #{prductCd}
|
|
|
|
AND tpi.prduct_cd = #{prductCd}
|
|
|
|
<if test="deptCd != null and deptCd != ''">
|
|
|
|
<if test="deptCd != null and deptCd != ''">
|
|
|
|
AND tdm.dept_cd = #{deptCd} <!-- 관할 관청 -->
|
|
|
|
AND tdm.dept_cd = #{deptCd} <!-- 관할 관청 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schDateFrom != null">
|
|
|
|
<if test="schDateFrom != null">
|
|
|
|
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
|
|
|
|
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schDateTo != null">
|
|
|
|
<if test="schDateTo != null">
|
|
|
|
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
|
|
|
|
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schSttsCd != null">
|
|
|
|
<if test="schSttsCd != null">
|
|
|
|
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
|
|
|
|
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="prgrsSttsCd != null">
|
|
|
|
<if test="prgrsSttsCd != null">
|
|
|
|
AND tdm.prgrs_stts_cd = #{prgrsSttsCd} <!-- 진행 상태 -->
|
|
|
|
AND tdm.prgrs_stts_cd = #{prgrsSttsCd} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
@ -363,45 +363,45 @@
|
|
|
|
<select id="selectDsuseMgtDsuseQyByIndutyStatisticsDtls" parameterType="map" resultType="dataobject">
|
|
|
|
<select id="selectDsuseMgtDsuseQyByIndutyStatisticsDtls" parameterType="map" resultType="dataobject">
|
|
|
|
/* 취급 업종별 폐기 현황 상세 목록 */
|
|
|
|
/* 취급 업종별 폐기 현황 상세 목록 */
|
|
|
|
SELECT ROW_NUMBER() over (ORDER BY tdm.dept_cd, tdm.dsuse_de DESC, tdm.dsuse_mth_cd) AS ROW_NUM
|
|
|
|
SELECT ROW_NUMBER() over (ORDER BY tdm.dept_cd, tdm.dsuse_de DESC, tdm.dsuse_mth_cd) AS ROW_NUM
|
|
|
|
, tdm.dept_cd
|
|
|
|
, tdm.dept_cd
|
|
|
|
, td.dept_nm
|
|
|
|
, td.dept_nm
|
|
|
|
, tdm.dsuse_de
|
|
|
|
, tdm.dsuse_de
|
|
|
|
, tcc.code_val AS dsuse_mth_nm
|
|
|
|
, tcc.code_val AS dsuse_mth_nm
|
|
|
|
, tbi.bssh_nm
|
|
|
|
, tbi.bssh_nm
|
|
|
|
, tbi.rprsntv_nm
|
|
|
|
, tbi.rprsntv_nm
|
|
|
|
, tbi.induty_nm
|
|
|
|
, tbi.induty_nm
|
|
|
|
, tdm.dscdmng_id
|
|
|
|
, tdm.dscdmng_id
|
|
|
|
, tdm.rnd_dtl_rpt_cnt
|
|
|
|
, tdm.rnd_dtl_rpt_cnt
|
|
|
|
, tdmd.prduct_cd
|
|
|
|
, tdmd.prduct_cd
|
|
|
|
, tpi.prduct_nm
|
|
|
|
, tpi.prduct_nm
|
|
|
|
, tdmd.dsuse_qy
|
|
|
|
, tdmd.dsuse_qy
|
|
|
|
FROM tb_dsuse_mgt tdm
|
|
|
|
FROM tb_dsuse_mgt tdm
|
|
|
|
JOIN tb_dsuse_mgt_dtl tdmd
|
|
|
|
JOIN tb_dsuse_mgt_dtl tdmd
|
|
|
|
ON tdm.dscdmng_id = tdmd.dscdmng_id
|
|
|
|
ON tdm.dscdmng_id = tdmd.dscdmng_id
|
|
|
|
JOIN tb_prduct_info tpi
|
|
|
|
JOIN tb_prduct_info tpi
|
|
|
|
ON tdmd.prduct_cd = tpi.prduct_cd
|
|
|
|
ON tdmd.prduct_cd = tpi.prduct_cd
|
|
|
|
JOIN tb_dept td
|
|
|
|
JOIN tb_dept td
|
|
|
|
ON tdm.dept_cd = td.dept_cd
|
|
|
|
ON tdm.dept_cd = td.dept_cd
|
|
|
|
JOIN tb_bssh_info tbi
|
|
|
|
JOIN tb_bssh_info tbi
|
|
|
|
ON tdm.bssh_cd = tbi.bssh_cd
|
|
|
|
ON tdm.bssh_cd = tbi.bssh_cd
|
|
|
|
LEFT JOIN tb_cmn_code tcc
|
|
|
|
LEFT JOIN tb_cmn_code tcc
|
|
|
|
ON (tcc.grp_id = 'ADDS05'
|
|
|
|
ON (tcc.grp_id = 'ADDS05'
|
|
|
|
AND tdm.dsuse_mth_cd = tcc.code)
|
|
|
|
AND tdm.dsuse_mth_cd = tcc.code)
|
|
|
|
WHERE tdm.use_yn = 'Y'
|
|
|
|
WHERE tdm.use_yn = 'Y'
|
|
|
|
<if test="deptCd != null and deptCd != ''">
|
|
|
|
<if test="deptCd != null and deptCd != ''">
|
|
|
|
AND tdm.dept_cd = #{deptCd} <!-- 관할 관청 -->
|
|
|
|
AND tdm.dept_cd = #{deptCd} <!-- 관할 관청 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schDateFrom != null">
|
|
|
|
<if test="schDateFrom != null">
|
|
|
|
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
|
|
|
|
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schDateTo != null">
|
|
|
|
<if test="schDateTo != null">
|
|
|
|
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
|
|
|
|
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schSttsCd != null">
|
|
|
|
<if test="schSttsCd != null">
|
|
|
|
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
|
|
|
|
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="indutyNm != null">
|
|
|
|
<if test="indutyNm != null">
|
|
|
|
AND tbi.induty_nm = #{indutyNm} <!-- 진행 상태 -->
|
|
|
|
AND tbi.induty_nm = #{indutyNm} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
@ -486,49 +486,49 @@
|
|
|
|
<select id="selectDsuseMgtDsuseQyByBsshStatisticsDtls" parameterType="map" resultType="dataobject">
|
|
|
|
<select id="selectDsuseMgtDsuseQyByBsshStatisticsDtls" parameterType="map" resultType="dataobject">
|
|
|
|
/* 마약류 취급자별 상세 목록 */
|
|
|
|
/* 마약류 취급자별 상세 목록 */
|
|
|
|
SELECT ROW_NUMBER() over (ORDER BY tdm.dept_cd, tdm.dsuse_de DESC, tdm.dsuse_mth_cd) AS ROW_NUM
|
|
|
|
SELECT ROW_NUMBER() over (ORDER BY tdm.dept_cd, tdm.dsuse_de DESC, tdm.dsuse_mth_cd) AS ROW_NUM
|
|
|
|
, tdm.dept_cd
|
|
|
|
, tdm.dept_cd
|
|
|
|
, td.dept_nm
|
|
|
|
, td.dept_nm
|
|
|
|
, tdm.dsuse_de
|
|
|
|
, tdm.dsuse_de
|
|
|
|
, tcc.code_val AS prgrs_stts_nm
|
|
|
|
, tcc.code_val AS prgrs_stts_nm
|
|
|
|
, tcc2.code_val AS dsuse_mth_nm
|
|
|
|
, tcc2.code_val AS dsuse_mth_nm
|
|
|
|
, tbi.bssh_nm
|
|
|
|
, tbi.bssh_nm
|
|
|
|
, tbi.rprsntv_nm
|
|
|
|
, tbi.rprsntv_nm
|
|
|
|
, tdm.dscdmng_id
|
|
|
|
, tdm.dscdmng_id
|
|
|
|
, tdm.rnd_dtl_rpt_cnt
|
|
|
|
, tdm.rnd_dtl_rpt_cnt
|
|
|
|
, tdmd.prduct_cd
|
|
|
|
, tdmd.prduct_cd
|
|
|
|
, tpi.prduct_nm
|
|
|
|
, tpi.prduct_nm
|
|
|
|
, tdmd.dsuse_qy
|
|
|
|
, tdmd.dsuse_qy
|
|
|
|
FROM tb_dsuse_mgt tdm
|
|
|
|
FROM tb_dsuse_mgt tdm
|
|
|
|
JOIN tb_dsuse_mgt_dtl tdmd
|
|
|
|
JOIN tb_dsuse_mgt_dtl tdmd
|
|
|
|
ON tdm.dscdmng_id = tdmd.dscdmng_id
|
|
|
|
ON tdm.dscdmng_id = tdmd.dscdmng_id
|
|
|
|
JOIN tb_prduct_info tpi
|
|
|
|
JOIN tb_prduct_info tpi
|
|
|
|
ON tdmd.prduct_cd = tpi.prduct_cd
|
|
|
|
ON tdmd.prduct_cd = tpi.prduct_cd
|
|
|
|
JOIN tb_dept td
|
|
|
|
JOIN tb_dept td
|
|
|
|
ON tdm.dept_cd = td.dept_cd
|
|
|
|
ON tdm.dept_cd = td.dept_cd
|
|
|
|
JOIN tb_bssh_info tbi
|
|
|
|
JOIN tb_bssh_info tbi
|
|
|
|
ON tdm.bssh_cd = tbi.bssh_cd
|
|
|
|
ON tdm.bssh_cd = tbi.bssh_cd
|
|
|
|
LEFT JOIN tb_cmn_code tcc
|
|
|
|
LEFT JOIN tb_cmn_code tcc
|
|
|
|
ON (tcc.grp_id = 'ADDS11'
|
|
|
|
ON (tcc.grp_id = 'ADDS11'
|
|
|
|
AND tdm.prgrs_stts_cd = tcc.code)
|
|
|
|
AND tdm.prgrs_stts_cd = tcc.code)
|
|
|
|
LEFT JOIN tb_cmn_code tcc2
|
|
|
|
LEFT JOIN tb_cmn_code tcc2
|
|
|
|
ON (tcc2.grp_id = 'ADDS05'
|
|
|
|
ON (tcc2.grp_id = 'ADDS05'
|
|
|
|
AND tdm.dsuse_mth_cd = tcc2.code)
|
|
|
|
AND tdm.dsuse_mth_cd = tcc2.code)
|
|
|
|
WHERE tdm.use_yn = 'Y'
|
|
|
|
WHERE tdm.use_yn = 'Y'
|
|
|
|
AND tdm.bssh_cd = #{bsshCd}
|
|
|
|
AND tdm.bssh_cd = #{bsshCd}
|
|
|
|
<if test="deptCd != null and deptCd != ''">
|
|
|
|
<if test="deptCd != null and deptCd != ''">
|
|
|
|
AND tdm.dept_cd = #{deptCd} <!-- 관할 관청 -->
|
|
|
|
AND tdm.dept_cd = #{deptCd} <!-- 관할 관청 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schDateFrom != null">
|
|
|
|
<if test="schDateFrom != null">
|
|
|
|
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
|
|
|
|
AND tdm.dsuse_de <![CDATA[>=]]> #{schDateFrom} <!-- 폐기 일자 시작 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schDateTo != null">
|
|
|
|
<if test="schDateTo != null">
|
|
|
|
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
|
|
|
|
AND tdm.dsuse_de <![CDATA[<=]]> #{schDateTo} <!-- 폐기 일자 종료 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="schSttsCd != null">
|
|
|
|
<if test="schSttsCd != null">
|
|
|
|
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
|
|
|
|
AND tdm.prgrs_stts_cd = #{schSttsCd} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
<if test="prgrsSttsCd != null">
|
|
|
|
<if test="prgrsSttsCd != null">
|
|
|
|
AND tdm.prgrs_stts_cd = #{prgrsSttsCd} <!-- 진행 상태 -->
|
|
|
|
AND tdm.prgrs_stts_cd = #{prgrsSttsCd} <!-- 진행 상태 -->
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
</mapper>
|
|
|
|
</mapper>
|
|
|
|