Browse Source

쿼리튜닝

DESKTOP-P60829B\User 2 years ago
parent
commit
fcf7dbb5e4
1 changed files with 22 additions and 7 deletions
  1. 22 7
      src/main/resources/sqlmap/mappers/cs/cs0301/CS03010001UMapper.xml

+ 22 - 7
src/main/resources/sqlmap/mappers/cs/cs0301/CS03010001UMapper.xml

@@ -6,10 +6,10 @@
 	<select id="getDeftList" resultType="easyHashMap">
 		SELECT A.CMPN_CD																		/*회사 코드*/
 		     , A.DEFT_PRCG_STUS_CD      														/*하자처리상태코드[CS009]*/
-		     , ZEHR_CODE_NAME_FNC(#{cmpnCd},'CS009',A.DEFT_PRCG_STUS_CD)	DEFT_PRCG_STUS_NM	/*하자처리상태코드명[CS009]*/
+		     , P1.CODE_NM        AS    DEFT_PRCG_STUS_NM	/*하자처리상태코드명[CS009]*/  
 		     , ROUND(SYSDATE - A.OFFR_DT,0) ELPS_DAY      												/*경과*/
 			 , A.EMG_GB_CD              														/*긴급 구분코드[CS020]*/
-			 , ZEHR_CODE_NAME_FNC(#{cmpnCd},'CS020',A.EMG_GB_CD)	EMG_GB_NM					/*긴급 구분명[CS020]*/
+			 , P2.CODE_NM        AS  EMG_GB_NM					/*긴급 구분명[CS020]*/
 			 , A.DEFT_NO                														/*하자번호*/
 			 , A.OFFR_DT 																		/*신청일자*/
 			 , A.RCPT_DT 																		/*접수일자*/
@@ -38,8 +38,8 @@
 			 , A.DEFT_CAUS_NO           														/*하자원인번호*/
 			 , I.DEFT_CAUS_NM																	/*하자원인명*/
 			 , A.PRCG_MNBD_CD																	/*시공주체코드[CS011]*/
-			 , ZEHR_CODE_NAME_FNC(#{cmpnCd},'CS011',A.PRCG_MNBD_CD)	PRCG_MNBD_NM				/*시공주체명[CS011]*/
-			 , D.PGPR_NM																		/*처리자 명*/
+			 , P3.CODE_NM        AS PRCG_MNBD_NM				/*시공주체명[CS011]*/
+			 , A.PGPR_NM																		/*처리자 명*/
 			 , A.VENDR_LBPR_NM 																	/*담당자*/
 			 , A.WORK_WKI_NO																	/*작업_지시서_번호*/
 			 , F_DECRYPT_FNC(A.VENDR_LBPR_MAIL) VENDR_LBPR_MAIL									/*업체 담당자 메일*/
@@ -59,16 +59,31 @@
 		  FROM TCS_DEFT A
 		  LEFT JOIN TCS_DEFT_ELPS B ON A.CMPN_CD = B.CMPN_CD AND A.DEFT_NO = B.DEFT_NO AND A.VIS_ELPS_SEQ = B.PRCG_ELPS_SEQ 			/*방문경과순번*/
 		  LEFT JOIN TCS_DEFT_ELPS C ON A.CMPN_CD = C.CMPN_CD AND A.DEFT_NO = C.DEFT_NO AND A.WORK_ELPS_SEQ = C.PRCG_ELPS_SEQ			/*작업경과순번*/
-		  LEFT JOIN TCS_DEFT_ELPS D ON A.CMPN_CD = D.CMPN_CD AND A.DEFT_NO = D.DEFT_NO AND A.PRCG_ELPS_SEQ = D.PRCG_ELPS_SEQ			/*처리경과순번*/
 		  LEFT JOIN TCS_DEFT_CUSTSIGN E ON A.CMPN_CD = E.CMPN_CD AND A.DEFT_NO = E.DEFT_NO												/*서명*/
 		  LEFT JOIN TCS_SITE_STD_LOC F ON A.CMPN_CD = F.CMPN_CD AND A.SITE_CD = F.SITE_CD AND A.LOC_NO = F.LOC_NO						/*위치*/
 		  LEFT JOIN TCS_SITE_STD_JOBTYP G ON A.CMPN_CD = G.CMPN_CD AND A.SITE_CD = G.SITE_CD AND A.DEFT_JOBTYP_NO = G.DEFT_JOBTYP_NO	/*하자공종*/
 		  LEFT JOIN TCS_SITE_STD_TYPE H ON A.CMPN_CD = H.CMPN_CD AND A.SITE_CD = H.SITE_CD AND A.DEFT_TYPE_NO = H.DEFT_TYPE_NO			/*하자유형*/
 		  LEFT JOIN TCS_SITE_STD_CAUS I ON A.CMPN_CD = I.CMPN_CD AND A.SITE_CD = I.SITE_CD AND A.DEFT_CAUS_NO = I.DEFT_CAUS_NO			/*하자원인*/
-		  LEFT JOIN TCS_SITE J ON A.CMPN_CD = J.CMPN_CD AND A.SITE_CD = J.SITE_CD														/*현장계약업체*/
-		  LEFT JOIN TCS_DEFT_ELPS K ON A.CMPN_CD = K.CMPN_CD AND A.DEFT_NO = K.DEFT_NO AND K.PRCG_ELPS_SEQ = (SELECT MAX(PRCG_ELPS_SEQ) FROM TCS_DEFT_ELPS WHERE DEFT_NO = A.DEFT_NO)	/*하자처리경과*/
 		  LEFT JOIN SM_COM_COVEND L ON A.CMPN_CD = L.CMPN_CD AND A.PRCG_COVEND_ID = L.COVEND_ID 										/*협력업체관리*/
 		  JOIN TCS_AUTH_USERSITE M ON A.CMPN_CD = M.CMPN_CD AND A.SITE_CD = M.SITE_CD AND M.USER_ID = #{userId}
+		  JOIN (SELECT A.CMPN_CD, B.SPEC_CD, B.SPEC_CD_NM AS CODE_NM
+                  FROM SM_COM_COMMCD A
+                 INNER JOIN SM_COM_COMMCD_D B ON A.COMM_CD_ID = B.COMM_CD_ID
+                 WHERE A.CMPN_CD       = #{cmpnCd}
+                   AND A.COMM_CD       = 'CS009'
+               ) P1 ON A.CMPN_CD = P1.CMPN_CD AND A.DEFT_PRCG_STUS_CD = P1.SPEC_CD
+          JOIN (SELECT A.CMPN_CD, B.SPEC_CD, B.SPEC_CD_NM AS CODE_NM
+                  FROM SM_COM_COMMCD A
+                 INNER JOIN SM_COM_COMMCD_D B ON A.COMM_CD_ID = B.COMM_CD_ID
+                 WHERE A.CMPN_CD       = #{cmpnCd}
+                   AND A.COMM_CD       = 'CS020'
+               ) P2 ON A.CMPN_CD = P2.CMPN_CD AND A.EMG_GB_CD = P2.SPEC_CD
+          JOIN (SELECT A.CMPN_CD, B.SPEC_CD, B.SPEC_CD_NM AS CODE_NM
+                  FROM SM_COM_COMMCD A
+                 INNER JOIN SM_COM_COMMCD_D B ON A.COMM_CD_ID = B.COMM_CD_ID
+                 WHERE A.CMPN_CD       = #{cmpnCd}
+                   AND A.COMM_CD       = 'CS011'
+               ) P3 ON A.CMPN_CD = P3.CMPN_CD AND A.PRCG_MNBD_CD = P3.SPEC_CD  
 		 WHERE A.CMPN_CD = #{cmpnCd}						/*회사코드*/
 		<if test="siteMngGbCd != '' and siteMngGbCd != 'all'">
 		   AND J.SITE_MNG_GB_CD = #{siteMngGbCd}			/*관리구분*/