<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.siginfo.dao.MainDao">

    <select id="getOnlineCenterStatus" resultType="java.util.HashMap">
    	SELECT A.*,
	           B.COMM_STATE,
	           B.SIMUL_FLAG
	      FROM        
	        (SELECT TI.REGION_CD,
	               COUNT(*) TOT,
	               (SELECT COUNT(*) 
	                  FROM (SELECT REGION_CD,DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE FROM TB_INT) A,
	                  (SELECT REGION_CD,INT_NO, COLLCT_DTIME,
                       CASE WHEN COLLCT_DTIME > (SYSDATE - 5/24/60) THEN 0 ELSE 1 END COMM_ON_OFF_FLAG 
                       -- CASE WHEN COLLCT_DTIME > (SYSDATE - 5/24/60) THEN COMM_ON_OFF_FLAG ELSE '1' END COMM_ON_OFF_FLAG 
                   FROM TB_INT_STATUS) B
	                 WHERE A.REGION_CD = B.REGION_CD
	                   AND A.INT_NO_SE = B.INT_NO
	                   AND NVL(B.COMM_ON_OFF_FLAG,'1') = 1
	                   AND A.REGION_CD = TI.REGION_CD) ERR_CNT 
	          FROM TB_INT TI
	         GROUP BY TI.REGION_CD) A, TB_REGION_CENTER B
	    WHERE A.REGION_CD = B.REGION_CD
	    ORDER BY A.REGION_CD
    </select>
    
    <select id="getOfflineCenterStatus" resultType="java.util.HashMap">
    	SELECT A.REGION_CD,
               COUNT(*) TOT, 
               (SELECT COUNT(*) ERR_CNT FROM
                 (SELECT  
                       CASE WHEN TO_CHAR(COLLECT_TIME, 'YYYYMMDD HH24:MI:SS') > TO_CHAR(SYSDATE-1/24/60, 'YYYYMMDD HH24:MI:SS') THEN 0 
                       ELSE 1 
                       END COMM_ON_OFF_FLAG 
                  FROM TB_INT_CVIB_STATUS)
                 WHERE COMM_ON_OFF_FLAG = 1
                   AND REGION_CD = A.REGION_CD) ERR_CNT,
               '' COMM_STATE
          FROM
            TB_INT_CVIB_STATUS A
        GROUP BY A.REGION_CD
    </select>
    
    <select id="getOnlineIntStatus" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT A.REGION_CD,
               A.SIGUNGU_CD,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.INT_NO) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_NO,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',NVL(B.COMM_ON_OFF_FLAG,'1')) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) COMM_ON_OFF_FLAG,
               COUNT(A.INT_NO) INT_CNT
          FROM
            (SELECT TI.REGION_CD,
                   DECODE(TI.MAIN_INTNO,0,TI.INT_NO,TI.MAIN_INTNO) INT_NO_SE, 
                   TI.INT_NO,
                   NVL(TS.SIGUNGU_CD,'99999') SIGUNGU_CD
              FROM TB_INT TI LEFT OUTER JOIN
                  (SELECT SIGUNGU_CD
                     FROM TB_SIGUNGU) TS
                ON TI.SIGUNGU_CD = TS.SIGUNGU_CD
             WHERE TI.REGION_CD IN
             	<foreach collection="regionCdArr" item="regionCd" open="(" close=")" separator=",">
       	 		#{regionCd}
	  	        </foreach>
                ORDER BY REGION_CD,INT_NO_SE,INT_NO) A,
                (SELECT REGION_CD,INT_NO, COLLCT_DTIME,
                        CASE WHEN COLLCT_DTIME > (SYSDATE - 5/24/60) THEN 0 ELSE 1 END COMM_ON_OFF_FLAG
                   FROM TB_INT_STATUS) B
        WHERE A.REGION_CD = B.REGION_CD
          AND A.INT_NO_SE = B.INT_NO
         GROUP BY A.REGION_CD, A.SIGUNGU_CD
    </select>
    
    <select id="getOfflineIntStatus" parameterType="java.util.HashMap" resultType="java.util.HashMap">
         SELECT A.REGION_CD,
               A.SIGUNGU_CD,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.INT_NO) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_NO,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',NVL(B.COMM_ON_OFF_FLAG,'1')) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) COMM_ON_OFF_FLAG,
               COUNT(A.INT_NO) INT_CNT
          FROM
            (SELECT TI.REGION_CD,
                   DECODE(TI.MAIN_INTNO,0,TI.INT_NO,TI.MAIN_INTNO) INT_NO_SE, 
                   TI.INT_NO,
                   NVL(TS.SIGUNGU_CD,'99999') SIGUNGU_CD
              FROM TB_INT TI LEFT OUTER JOIN
                  (SELECT SIGUNGU_CD FROM TB_SIGUNGU) TS
                ON TI.SIGUNGU_CD = TS.SIGUNGU_CD
             WHERE TI.REGION_CD IN 
             	<foreach collection="regionCdArr" item="regionCd" open="(" close=")" separator=",">
       	 		#{regionCd}
	  	        </foreach>
                ORDER BY REGION_CD,INT_NO_SE,INT_NO) A, 
                (SELECT REGION_CD, INT_NO, 
                        CASE WHEN TO_CHAR(COLLECT_TIME, 'YYYYMMDD HH24:MI:SS') > TO_CHAR(SYSDATE-1/24/60, 'YYYYMMDD HH24:MI:SS') THEN 0
                        ELSE 1
                        END COMM_ON_OFF_FLAG FROM TB_INT_CVIB_STATUS) B
        WHERE A.REGION_CD = B.REGION_CD
          AND A.INT_NO_SE = B.INT_NO
         GROUP BY A.REGION_CD, A.SIGUNGU_CD
    </select>
    
    <select id="getIntTreeList" resultType="java.util.HashMap">
		SELECT BB.REGION_CD,
               BB.REGION_NM,
               (RPAD(BB.X_COORD,9,0) / 1000000) X_COORD,
               (RPAD(BB.Y_COORD,8,0) / 1000000) Y_COORD,
               AA.SIGUNGU_CD,
               AA.SIGUNGU_NM,
               AA.INT_NO,
               AA.INT_NM,
               AA.INT_X_COORD,
               AA.INT_Y_COORD,
               AA.NETWORK_TYPE,
               AA.NODE_ID,
               AA.SIGUNGU_X,
               AA.SIGUNGU_Y
          FROM
       (SELECT A.REGION_CD,
               A.SIGUNGU_CD,
               MAX(A.SIGUNGU_NM) SIGUNGU_NM,
               -- SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.INT_NO) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_NO,
               -- SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.INT_NM) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_NM,
               -- SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.X_COORD) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_X_COORD,
               -- SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.Y_COORD) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_Y_COORD,
               -- SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.NETWORK_TYPE) ORDER BY A.INT_NO_SE,A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) NETWORK_TYPE,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.INT_NO) ORDER BY A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_NO,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.INT_NM) ORDER BY A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_NM,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.X_COORD) ORDER BY A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_X_COORD,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.Y_COORD) ORDER BY A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_Y_COORD,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.NETWORK_TYPE) ORDER BY A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) NETWORK_TYPE,
               SUBSTR(XMLAGG(XMLELEMENT(COL,'|',A.NODE_ID) ORDER BY A.INT_NO).EXTRACT('//text()').GETCLOBVAL(),2) NODE_ID,
               MAX(SIGUNGU_X) SIGUNGU_X,
               MAX(SIGUNGU_Y) SIGUNGU_Y
          FROM
            (SELECT TI.REGION_CD,
                   DECODE(TI.MAIN_INTNO,0,TI.INT_NO,TI.MAIN_INTNO) INT_NO_SE, 
                   TI.INT_NO,
                   TI.INT_NM,
                   (RPAD(TI.X_COORD,9,0) / 1000000) X_COORD,
                   (RPAD(TI.Y_COORD,8,0) / 1000000) Y_COORD,
                   NVL(TS.SIGUNGU_CD,'99999') SIGUNGU_CD,
                   NVL(TS.SIGUNGU_NM,'기타') SIGUNGU_NM,
                   NVL(TS.SIGUNGU_X,'') SIGUNGU_X,
                   NVL(TS.SIGUNGU_Y,'') SIGUNGU_Y,
                   TI.NETWORK_TYPE,
                   TIN.NODE_ID
              FROM TB_INT TI LEFT OUTER JOIN
                  (SELECT REGION_CD,
                  		  SIGUNGU_CD,
                          SIGUNGU_NM,
                          X_COORD SIGUNGU_X,
                          Y_COORD SIGUNGU_Y
                     FROM TB_SIGUNGU) TS
                ON TI.SIGUNGU_CD = TS.SIGUNGU_CD
                AND TI.REGION_CD = TS.REGION_CD
                LEFT OUTER JOIN TB_INT_NODE TIN
                ON TIN.REGION_CD = TI.REGION_CD
                AND TIN.INT_NO = TI.INT_NO
                WHERE TI.NETWORK_TYPE = 0
                ORDER BY REGION_CD,INT_NO_SE,INT_NO) A LEFT OUTER JOIN TB_INT_STATUS B
           ON A.REGION_CD = B.REGION_CD
          AND A.INT_NO_SE = B.INT_NO
         GROUP BY A.REGION_CD, A.SIGUNGU_CD) AA, TB_REGION_CENTER BB
         WHERE AA.REGION_CD = BB.REGION_CD
         ORDER BY AA.REGION_CD, DECODE(AA.SIGUNGU_NM,'기타','희',AA.SIGUNGU_NM)
    </select>
    
    <select id="getGroupTreeList" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT TRC.REGION_CD,
               TRC.REGION_NM REGION_NM,
               (RPAD(TRC.X_COORD,9,0) / 1000000) X_COORD,
               (RPAD(TRC.Y_COORD,8,0) / 1000000) Y_COORD,
               TT.SIGUNGU_CD,
               TT.SIGUNGU_NM,
               NVL(TT.GROUP_NM,(TRC.REGION_NM || '(0/0)')) GROUP_NM,
               NVL(TT.INT_NO,'') INT_NO,
               NVL(TT.INT_NM,'') INT_NM,
               TT.INT_X_COORD,
               TT.INT_Y_COORD,
               TT.SIGUNGU_X,
               TT.SIGUNGU_Y
          FROM TB_REGION_CENTER TRC 
          LEFT OUTER JOIN
            (SELECT MAX(AA.REGION_CD) REGION_CD,
                    MAX(AA.SIGUNGU_CD) SIGUNGU_CD,
                    AA.SIGUNGU_NM,
                    SUBSTR(XMLAGG(XMLELEMENT(COL,'@',AA.GROUP_NM) ORDER BY REGEXP_REPLACE(AA.GROUP_NO, '[0-9]') , to_number(REGEXP_REPLACE(AA.GROUP_NO, '[^0-9]'))).EXTRACT('//text()').GETCLOBVAL(),2) GROUP_NM,
                    SUBSTR(XMLAGG(XMLELEMENT(COL,'@',AA.INT_NO) ORDER BY REGEXP_REPLACE(AA.GROUP_NO, '[0-9]') , to_number(REGEXP_REPLACE(AA.GROUP_NO, '[^0-9]'))).EXTRACT('//text()').GETCLOBVAL(),2) INT_NO,
                    SUBSTR(XMLAGG(XMLELEMENT(COL,'@',AA.INT_NM) ORDER BY REGEXP_REPLACE(AA.GROUP_NO, '[0-9]') , to_number(REGEXP_REPLACE(AA.GROUP_NO, '[^0-9]'))).EXTRACT('//text()').GETCLOBVAL(),2) INT_NM,
                    SUBSTR(XMLAGG(XMLELEMENT(COL,'@',AA.INT_X_COORD) ORDER BY REGEXP_REPLACE(AA.GROUP_NO, '[0-9]') , to_number(REGEXP_REPLACE(AA.GROUP_NO, '[^0-9]'))).EXTRACT('//text()').GETCLOBVAL(),2) INT_X_COORD,
                    SUBSTR(XMLAGG(XMLELEMENT(COL,'@',AA.INT_Y_COORD) ORDER BY REGEXP_REPLACE(AA.GROUP_NO, '[0-9]') , to_number(REGEXP_REPLACE(AA.GROUP_NO, '[^0-9]'))).EXTRACT('//text()').GETCLOBVAL(),2) INT_Y_COORD,
                    MAX(SIGUNGU_X) SIGUNGU_X,
                    MAX(SIGUNGU_Y) SIGUNGU_Y 
              FROM
                (SELECT T1.REGION_CD,
                    T1.GROUP_NM,
                    T1.GROUP_NO,
                    T1.SIGUNGU_CD,
                    T1.SIGUNGU_NM,
                    T2.INT_NO,
                    T2.INT_NM,
                    T2.INT_X_COORD,
                    T2.INT_Y_COORD,
                    T1.SIGUNGU_X,
                    T1.SIGUNGU_Y
              	  FROM
                    (SELECT MAX(A.REGION_CD) REGION_CD,
                            MAX(B.REGION_NM) REGION_NM,
                            MAX(A.SIGUNGU_NM) || '-' || '그룹번호_#' || NVL(MAX(A.GROUP_NO),'0') GROUP_NM,
                            A.GROUP_NO,
                            MAX(A.SIGUNGU_CD) SIGUNGU_CD,
                            MAX(A.SIGUNGU_NM) SIGUNGU_NM,
                            MAX(A.SIGUNGU_X) SIGUNGU_X,
                            MAX(A.SIGUNGU_Y) SIGUNGU_Y 
                       FROM (SELECT AA.REGION_CD,
		                            AA.INT_NO,
		                            AA.GROUP_NO,
		                            BB.SIGUNGU_CD,
		                            BB.SIGUNGU_NM,
		                            BB.X_COORD SIGUNGU_X,
		                            BB.Y_COORD SIGUNGU_Y
	                            FROM
			                        (SELECT TI.REGION_CD,
			                    		 	TI.INT_NO,
			                                (TI.REGION_CD||TI.GROUP_NO) GROUP_NO,
			                                TI.SIGUNGU_CD
			                           FROM TB_INT TI) AA, 
			                         TB_SIGUNGU BB
		                       WHERE AA.SIGUNGU_CD = BB.SIGUNGU_CD
		                     ) A 
	                    LEFT OUTER JOIN TB_REGION_CENTER B ON A.REGION_CD = B.REGION_CD
                        GROUP BY A.GROUP_NO) T1 
                     LEFT OUTER JOIN (SELECT MAX(REGION_CD) REGION_CD,
					                         GROUP_NO,
					                         SUBSTR(XMLAGG(XMLELEMENT(COL,'|',INT_NO) ORDER BY SORT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_NO,
					                         SUBSTR(XMLAGG(XMLELEMENT(COL,'|',INT_NM) ORDER BY SORT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_NM,
					                         SUBSTR(XMLAGG(XMLELEMENT(COL,'|',X_COORD) ORDER BY SORT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_X_COORD,
					                         SUBSTR(XMLAGG(XMLELEMENT(COL,'|',Y_COORD) ORDER BY SORT_NO).EXTRACT('//text()').GETCLOBVAL(),2) INT_Y_COORD
				                       FROM
			                               (SELECT A.REGION_CD,
			                                      (A.REGION_CD || A.INT_NO) INT_NO,
			                                      TO_NUMBER((SUBSTR(A.REGION_CD, 2, LENGTH(A.REGION_CD)) || A.INT_NO)) SORT_NO,
				                                   A.INT_NM,
				                                  (RPAD(A.X_COORD,9,0) / 1000000) X_COORD,
				                                  (RPAD(A.Y_COORD,8,0) / 1000000) Y_COORD,
				                                  (A.REGION_CD || A.GROUP_NO) GROUP_NO 
				                              FROM TB_INT A, TB_INT_STATUS B
			                            	 WHERE A.REGION_CD = B.REGION_CD
			                              	   AND A.INT_NO = B.INT_NO)
				                       GROUP BY GROUP_NO) T2
               			 ON T1.REGION_CD = T2.REGION_CD
             		 	AND T1.GROUP_NO = T2.GROUP_NO) AA
            			GROUP BY AA.SIGUNGU_NM
              ) TT
           ON TRC.REGION_CD = TT.REGION_CD
        ORDER BY TT.REGION_CD, DECODE(TT.SIGUNGU_NM,'기타','희',TT.SIGUNGU_NM)
    </select>
    
    <select id="getIntNm" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT REGION_CD,INT_NO,INT_NM FROM TB_INT
    </select>
    
    <select id="getSidoSignalInfo" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT T1.*,
                    T2.REGION_NM,
                    T2.SIMUL_FLAG,
                    T2.COMM_STATE              
             FROM
             (
                SELECT AA.*,
                       TIP.A_RING_1_PHASE_CONF_CD,
                       TIP.A_RING_2_PHASE_CONF_CD,
                       TIP.A_RING_3_PHASE_CONF_CD,
                       TIP.A_RING_4_PHASE_CONF_CD,
                       TIP.A_RING_5_PHASE_CONF_CD,
                       TIP.A_RING_6_PHASE_CONF_CD,
                       TIP.A_RING_7_PHASE_CONF_CD,
                       TIP.A_RING_8_PHASE_CONF_CD,
                       TIP.B_RING_1_PHASE_CONF_CD,
                       TIP.B_RING_2_PHASE_CONF_CD,
                       TIP.B_RING_3_PHASE_CONF_CD,
                       TIP.B_RING_4_PHASE_CONF_CD,
                       TIP.B_RING_5_PHASE_CONF_CD,
                       TIP.B_RING_6_PHASE_CONF_CD,
                       TIP.B_RING_7_PHASE_CONF_CD,
                       TIP.B_RING_8_PHASE_CONF_CD
                  FROM (
                        SELECT REGION_CD,
                               INT_NO,
                               A_RING_1_PHASE_CONF_CD,
                               A_RING_2_PHASE_CONF_CD,
                               A_RING_3_PHASE_CONF_CD,
                               A_RING_4_PHASE_CONF_CD,
                               A_RING_5_PHASE_CONF_CD,
                               A_RING_6_PHASE_CONF_CD,
                               A_RING_7_PHASE_CONF_CD,
                               A_RING_8_PHASE_CONF_CD,
                               B_RING_1_PHASE_CONF_CD,
                               B_RING_2_PHASE_CONF_CD,
                               B_RING_3_PHASE_CONF_CD,
                               B_RING_4_PHASE_CONF_CD,
                               B_RING_5_PHASE_CONF_CD,
                               B_RING_6_PHASE_CONF_CD,
                               B_RING_7_PHASE_CONF_CD,
                               B_RING_8_PHASE_CONF_CD,
                               MAP_NO
                          FROM TB_INT_PHASE
                       ) TIP,
                       (SELECT TI.*,
                               TIS.GROUP_NO,
                               TO_CHAR(TIS.COLLCT_DTIME,'YYYY-MM-DD HH24:MI') COLLCT_DTIME,
                               TIS.COMM_ON_OFF_FLAG,
                               TIS.CONTRLR_OPER_MODE_CD,
                               NVL(TIS.A_RING_PHASE_VAL,999) A_RING_PHASE_VAL,
                               NVL(TIS.B_RING_PHASE_VAL,999) B_RING_PHASE_VAL,
                               TIS.SIGLIGHT_TURNOFF_FLAG,
                               TIS.SIGLIGHT_BLINK_FLAG,
                               TIS.CONTRLR_MANUAL_FLAG,
                               TIS.CONTRLR_TMDIFF_CONTRL_FLAG,
                               TIS.INT_SIG_CYCLE_CNT,
                               TIS.INT_SIG_CYCLE_LEN,
                               TIS.PPC_CONTRL_FLAG,
                               NVL(TIS.A_RING_1_PHASE_VAL, 0) A_RING_1_PHASE_VAL,
                               NVL(TIS.A_RING_2_PHASE_VAL, 0) A_RING_2_PHASE_VAL,
                               NVL(TIS.A_RING_3_PHASE_VAL, 0) A_RING_3_PHASE_VAL,
                               NVL(TIS.A_RING_4_PHASE_VAL, 0) A_RING_4_PHASE_VAL,
                               NVL(TIS.A_RING_5_PHASE_VAL, 0) A_RING_5_PHASE_VAL,
                               NVL(TIS.A_RING_6_PHASE_VAL, 0) A_RING_6_PHASE_VAL,
                               NVL(TIS.A_RING_7_PHASE_VAL, 0) A_RING_7_PHASE_VAL,
                               NVL(TIS.A_RING_8_PHASE_VAL, 0) A_RING_8_PHASE_VAL,
                               NVL(TIS.B_RING_1_PHASE_VAL, 0) B_RING_1_PHASE_VAL,
                               NVL(TIS.B_RING_2_PHASE_VAL, 0) B_RING_2_PHASE_VAL,
                               NVL(TIS.B_RING_3_PHASE_VAL, 0) B_RING_3_PHASE_VAL,
                               NVL(TIS.B_RING_4_PHASE_VAL, 0) B_RING_4_PHASE_VAL,
                               NVL(TIS.B_RING_5_PHASE_VAL, 0) B_RING_5_PHASE_VAL,
                               NVL(TIS.B_RING_6_PHASE_VAL, 0) B_RING_6_PHASE_VAL,
                               NVL(TIS.B_RING_7_PHASE_VAL, 0) B_RING_7_PHASE_VAL,
                               NVL(TIS.B_RING_8_PHASE_VAL, 0) B_RING_8_PHASE_VAL,
                               TIS.MAP_NO
                          FROM
                               (
                                 SELECT REGION_CD,
                                        INT_NO,
                                        DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE,
                                        INT_NM,
                                        RPAD(X_COORD,9,0) / 1000000 X_COORD,
                                        RPAD(Y_COORD,8,0) / 1000000 Y_COORD,
                                        MAIN_INTNO,
                                        INT_LCTYPE,
                                        INT_LAMPTYPE,
                                        SIGUNGU_CD
                                   FROM TB_INT
                                  WHERE REGION_CD = #{regionCd}
                               ) TI, TB_INT_STATUS TIS
                        WHERE TI.REGION_CD = TIS.REGION_CD
                          AND TI.INT_NO_SE = TIS.INT_NO
                       ) AA
                        WHERE TIP.REGION_CD = AA.REGION_CD
                          AND TIP.INT_NO = AA.INT_NO
                          AND TIP.MAP_NO = AA.MAP_NO
                 ) T1, TB_REGION_CENTER T2
            WHERE T1.REGION_CD = T2.REGION_CD
    </select>
    
    <select id="getSignalInfo" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	     SELECT T1.*,
                    T2.REGION_NM,
                    T2.SIMUL_FLAG,
                    T2.COMM_STATE,
                    T2.REGION_ID 
               FROM
               	  ( SELECT TITIS.*,
                           TIP.A_RING_1_PHASE_CONF_CD,
                           TIP.A_RING_2_PHASE_CONF_CD,
                           TIP.A_RING_3_PHASE_CONF_CD,
                           TIP.A_RING_4_PHASE_CONF_CD,
                           TIP.A_RING_5_PHASE_CONF_CD,
                           TIP.A_RING_6_PHASE_CONF_CD,
                           TIP.A_RING_7_PHASE_CONF_CD,
                           TIP.A_RING_8_PHASE_CONF_CD,
                           TIP.B_RING_1_PHASE_CONF_CD,
                           TIP.B_RING_2_PHASE_CONF_CD,
                           TIP.B_RING_3_PHASE_CONF_CD,
                           TIP.B_RING_4_PHASE_CONF_CD,
                           TIP.B_RING_5_PHASE_CONF_CD,
                           TIP.B_RING_6_PHASE_CONF_CD,
                           TIP.B_RING_7_PHASE_CONF_CD,
                           TIP.B_RING_8_PHASE_CONF_CD,
                           TIP.INT_MAINPHASE
                      FROM ( SELECT REGION_CD,
                                    INT_NO,
                                    A_RING_1_PHASE_CONF_CD,
                                    A_RING_2_PHASE_CONF_CD,
                                    A_RING_3_PHASE_CONF_CD,
                                    A_RING_4_PHASE_CONF_CD,
                                    A_RING_5_PHASE_CONF_CD,
                                    A_RING_6_PHASE_CONF_CD,
                                    A_RING_7_PHASE_CONF_CD,
                                    A_RING_8_PHASE_CONF_CD,
                                    B_RING_1_PHASE_CONF_CD,
                                    B_RING_2_PHASE_CONF_CD,
                                    B_RING_3_PHASE_CONF_CD,
                                    B_RING_4_PHASE_CONF_CD,
                                    B_RING_5_PHASE_CONF_CD,
                                    B_RING_6_PHASE_CONF_CD,
                                    B_RING_7_PHASE_CONF_CD,
                                    B_RING_8_PHASE_CONF_CD,
                                    MAP_NO,
                                    INT_MAINPHASE
                               FROM TB_INT_PHASE
                           ) TIP RIGHT OUTER JOIN
                           ( SELECT TI.REGION_CD,
                                    TI.INT_NO,
                                    TI.INT_NO_SE,
                                    TI.INT_NM,
                                    TI.X_COORD,
                                    TI.Y_COORD,
                                    TI.MAIN_INTNO,
                                    TI.INT_LCTYPE,
                                    TI.INT_LAMPTYPE,
                                    TI.SIGUNGU_CD,
                                    TI.NETWORK_TYPE,
                                    NVL(TI.MODEM_IP,'-') MODEM_IP,
                                    TO_CHAR(TIS.COLLCT_DTIME,'YYYY-MM-DD HH24:MI') COLLCT_DTIME,
                                    NVL(TIS.COMM_ON_OFF_FLAG,1) COMM_ON_OFF_FLAG,
                                    NVL(TIS.CONTRLR_OPER_MODE_CD,0) CONTRLR_OPER_MODE_CD,
                                    NVL(TIS.A_RING_PHASE_VAL,999) A_RING_PHASE_VAL,
                                    NVL(TIS.B_RING_PHASE_VAL,999) B_RING_PHASE_VAL,
                                    NVL(TIS.SIGLIGHT_TURNOFF_FLAG,0) SIGLIGHT_TURNOFF_FLAG,
                                    NVL(TIS.SIGLIGHT_BLINK_FLAG,0) SIGLIGHT_BLINK_FLAG,
                                    NVL(TIS.CONTRLR_MANUAL_FLAG, 0) CONTRLR_MANUAL_FLAG,
                                    NVL(TIS.CONTRLR_TMDIFF_CONTRL_FLAG, 0) CONTRLR_TMDIFF_CONTRL_FLAG,
                                    TIS.INT_SIG_CYCLE_CNT,
                                    TIS.INT_SIG_CYCLE_LEN,
                                    NVL(TIS.A_RING_1_PHASE_VAL, 0) A_RING_1_PHASE_VAL,
                                    NVL(TIS.A_RING_2_PHASE_VAL, 0) A_RING_2_PHASE_VAL,
                                    NVL(TIS.A_RING_3_PHASE_VAL, 0) A_RING_3_PHASE_VAL,
                                    NVL(TIS.A_RING_4_PHASE_VAL, 0) A_RING_4_PHASE_VAL,
                                    NVL(TIS.A_RING_5_PHASE_VAL, 0) A_RING_5_PHASE_VAL,
                                    NVL(TIS.A_RING_6_PHASE_VAL, 0) A_RING_6_PHASE_VAL,
                                    NVL(TIS.A_RING_7_PHASE_VAL, 0) A_RING_7_PHASE_VAL,
                                    NVL(TIS.A_RING_8_PHASE_VAL, 0) A_RING_8_PHASE_VAL,
                                    NVL(TIS.B_RING_1_PHASE_VAL, 0) B_RING_1_PHASE_VAL,
                                    NVL(TIS.B_RING_2_PHASE_VAL, 0) B_RING_2_PHASE_VAL,
                                    NVL(TIS.B_RING_3_PHASE_VAL, 0) B_RING_3_PHASE_VAL,
                                    NVL(TIS.B_RING_4_PHASE_VAL, 0) B_RING_4_PHASE_VAL,
                                    NVL(TIS.B_RING_5_PHASE_VAL, 0) B_RING_5_PHASE_VAL,
                                    NVL(TIS.B_RING_6_PHASE_VAL, 0) B_RING_6_PHASE_VAL,
                                    NVL(TIS.B_RING_7_PHASE_VAL, 0) B_RING_7_PHASE_VAL,
                                    NVL(TIS.B_RING_8_PHASE_VAL, 0) B_RING_8_PHASE_VAL,
                                    NVL(TIS.MAP_NO, 0) MAP_NO,
                                    NVL(TIS.GROUP_NO,0) GROUP_NO,
                                    NVL(TIS.PPC_CONTRL_FLAG, '-') PPC_CONTRL_FLAG
                               FROM 
                              (
                                SELECT REGION_CD,
                                       INT_NO,
                                       DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE,
                                       INT_NM,
                                       RPAD(X_COORD,9,0) / 1000000 X_COORD,
                                       RPAD(Y_COORD,8,0) / 1000000 Y_COORD,
                                       MAIN_INTNO,
                                       INT_LCTYPE,
                                       INT_LAMPTYPE,
                                       SIGUNGU_CD,
                                       NETWORK_TYPE,
                                       MODEM_IP  
                                  FROM TB_INT
                              ) TI, TB_INT_STATUS TIS
                             WHERE TI.REGION_CD = TIS.REGION_CD
                               AND TI.INT_NO_SE = TIS.INT_NO
                           ) TITIS
                               ON TIP.REGION_CD = TITIS.REGION_CD
                              AND TIP.INT_NO = TITIS.INT_NO
                              AND TIP.MAP_NO = TITIS.MAP_NO
                            WHERE 1=1
	                           <choose>
	                           <when test='sidoFlag == "SIDO"'>
	      					   AND TITIS.REGION_CD = #{regionCd}
	      					   AND TITIS.X_COORD BETWEEN  #{minX} AND  #{maxX}
	                           AND TITIS.Y_COORD BETWEEN  #{minY} AND  #{maxY}
	      					   </when>
	      					   <when test='sidoFlag == "GROUP"'>
	      					   AND TITIS.REGION_CD = #{regionCd}
	      					   AND TITIS.GROUP_NO = #{groupNo}
	      					   </when>
	      					   <otherwise>
	                           AND TITIS.X_COORD BETWEEN  #{minX} AND  #{maxX}
	                           AND TITIS.Y_COORD BETWEEN  #{minY} AND  #{maxY}
	                           </otherwise>
	                           </choose>
                  ) T1, TB_REGION_CENTER T2
            WHERE T1.REGION_CD = T2.REGION_CD
            ORDER BY GROUP_NO, INT_NO 
    </select>
    
    <select id="getPopSignalInfo" parameterType="java.util.HashMap" resultType="java.util.HashMap">
   		 SELECT A.REGION_CD,
                   A.INT_NO,
                   A.INT_NM,
                   (RPAD(A.X_COORD,9,0) / 1000000) X_COORD,
                   (RPAD(A.Y_COORD,8,0) / 1000000) Y_COORD,
                   B.A_RING_1_PHASE_CONF_CD,
                   B.A_RING_2_PHASE_CONF_CD,
                   B.A_RING_3_PHASE_CONF_CD,
                   B.A_RING_4_PHASE_CONF_CD,
                   B.A_RING_5_PHASE_CONF_CD,
                   B.A_RING_6_PHASE_CONF_CD,
                   B.A_RING_7_PHASE_CONF_CD,
                   B.A_RING_8_PHASE_CONF_CD,
                   B.B_RING_1_PHASE_CONF_CD,
                   B.B_RING_2_PHASE_CONF_CD,
                   B.B_RING_3_PHASE_CONF_CD,
                   B.B_RING_4_PHASE_CONF_CD,
                   B.B_RING_5_PHASE_CONF_CD,
                   B.B_RING_6_PHASE_CONF_CD,
                   B.B_RING_7_PHASE_CONF_CD,
                   B.B_RING_8_PHASE_CONF_CD,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_1_PHASE_STRT_LINK_CD) A_RING_1_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_1_PHASE_END_LINK_CD) A_RING_1_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_2_PHASE_STRT_LINK_CD) A_RING_2_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_2_PHASE_END_LINK_CD) A_RING_2_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_3_PHASE_STRT_LINK_CD) A_RING_3_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_3_PHASE_END_LINK_CD) A_RING_3_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_4_PHASE_STRT_LINK_CD) A_RING_4_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_4_PHASE_END_LINK_CD) A_RING_4_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_5_PHASE_STRT_LINK_CD) A_RING_5_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_5_PHASE_END_LINK_CD) A_RING_5_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_6_PHASE_STRT_LINK_CD) A_RING_6_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_6_PHASE_END_LINK_CD) A_RING_6_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_7_PHASE_STRT_LINK_CD) A_RING_7_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_7_PHASE_END_LINK_CD) A_RING_7_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_8_PHASE_STRT_LINK_CD) A_RING_8_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.A_RING_8_PHASE_END_LINK_CD) A_RING_8_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_1_PHASE_STRT_LINK_CD) B_RING_1_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_1_PHASE_END_LINK_CD) B_RING_1_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_2_PHASE_STRT_LINK_CD) B_RING_2_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_2_PHASE_END_LINK_CD) B_RING_2_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_3_PHASE_STRT_LINK_CD) B_RING_3_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_3_PHASE_END_LINK_CD) B_RING_3_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_4_PHASE_STRT_LINK_CD) B_RING_4_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_4_PHASE_END_LINK_CD) B_RING_4_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_5_PHASE_STRT_LINK_CD) B_RING_5_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_5_PHASE_END_LINK_CD) B_RING_5_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_6_PHASE_STRT_LINK_CD) B_RING_6_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_6_PHASE_END_LINK_CD) B_RING_6_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_7_PHASE_STRT_LINK_CD) B_RING_7_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_7_PHASE_END_LINK_CD) B_RING_7_P_END_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_8_PHASE_STRT_LINK_CD) B_RING_8_P_STRT_VTX,
                   (SELECT VERTEX FROM VERTEX_BLOB WHERE LINKID = B.B_RING_8_PHASE_END_LINK_CD) B_RING_8_P_END_VTX
              FROM TB_INT A, 
              (
                SELECT TIP.*,
                       TIS.COLLCT_DTIME,
                       TIS.COMM_ON_OFF_FLAG,
                       TIS.CONTRLR_OPER_MODE_CD,
                       NVL(TIS.A_RING_PHASE_VAL,999) A_RING_PHASE_VAL,
                       NVL(TIS.B_RING_PHASE_VAL,999) B_RING_PHASE_VAL,
                       TIS.SIGLIGHT_TURNOFF_FLAG,
                       TIS.SIGLIGHT_BLINK_FLAG,
                       TIS.CONTRLR_MANUAL_FLAG,
                       TIS.INT_SIG_CYCLE_CNT,
                       TIS.INT_SIG_CYCLE_LEN,
                       TIS.A_RING_1_PHASE_VAL,
                       TIS.A_RING_2_PHASE_VAL,
                       TIS.A_RING_3_PHASE_VAL,
                       TIS.A_RING_4_PHASE_VAL,
                       TIS.A_RING_5_PHASE_VAL,
                       TIS.A_RING_6_PHASE_VAL,
                       TIS.A_RING_7_PHASE_VAL,
                       TIS.A_RING_8_PHASE_VAL,
                       TIS.B_RING_1_PHASE_VAL,
                       TIS.B_RING_2_PHASE_VAL,
                       TIS.B_RING_3_PHASE_VAL,
                       TIS.B_RING_4_PHASE_VAL,
                       TIS.B_RING_5_PHASE_VAL,
                       TIS.B_RING_6_PHASE_VAL,
                       TIS.B_RING_7_PHASE_VAL,
                       TIS.B_RING_8_PHASE_VAL,
                       TIS.MAP_NO,
                       TIS.GROUP_NO
                  FROM TB_INT_PHASE TIP, TB_INT_STATUS TIS
                        WHERE TIP.REGION_CD = TIS.REGION_CD
                          AND TIP.INT_NO = TIS.INT_NO
                          AND TIP.MAP_NO = TIS.MAP_NO
              ) B
             WHERE A.REGION_CD = #{regionCd}
               AND A.INT_NO = #{intNo}
               AND A.REGION_CD = B.REGION_CD
               AND A.INT_NO = B.INT_NO
    </select>
    
    <select id="getSelectRoad" parameterType="java.util.HashMap" resultType="java.util.HashMap">
        SELECT
			   ROADID
		     , ROADNAME
		     , XCOORD
		     , YCOORD
		     , VIEW_LEVEL
		     , CCTVID
		  FROM WALL_LIST_ROAD@UTIADMIN
		 WHERE CENTERID = #{CENTERID}
		 ORDER BY ROADNAME 
    </select>
    
    <select id="getSimulFlag" parameterType="java.util.HashMap" resultType="java.util.HashMap">
	     SELECT T1.*, 
                T2.MAP_NO AS MAP_NO_STATUS 
           FROM 
             (SELECT C.REGION_CD,
                    A.INT_NO,
                    A.INT_NO_SE,
                    CASE WHEN C.SIMUL_FLAG = 'N' THEN 'OFF'
                         WHEN C.SIMUL_FLAG = 'Y' THEN 'ON'
                     END SIMUL_FLAG,
                    B.MAP_NO 
               FROM
                   (SELECT REGION_CD,     
                           INT_NO,
                           DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE
                      FROM TB_INT
                     WHERE REGION_CD = #{regionCd}
                       AND INT_NO = #{intNo}) A, TB_INT_PHASE B, TB_REGION_CENTER C
                     WHERE A.REGION_CD = B.REGION_CD
                       AND A.INT_NO = B.INT_NO
                       AND A.REGION_CD = C.REGION_CD) T1 LEFT OUTER JOIN TB_INT_STATUS T2
               ON T1.REGION_CD = T2.REGION_CD
              AND T1.INT_NO_SE = T2.INT_NO
    </select>
    
    <select id="getTodayPlanNo" parameterType="java.util.HashMap" resultType="String">
	     SELECT B.INT_PLAN_NO 
           FROM
           (
            SELECT REGION_CD,
                   INT_NO,
                   DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE
              FROM TB_INT
             WHERE REGION_CD = #{regionCd}
               AND INT_NO = #{intNo}
           ) A, TB_INT_DY_PLAN B
          WHERE A.REGION_CD = B.REGION_CD
            AND A.INT_NO_SE = B.INT_NO
	        AND B.PLAN_DY = #{today}
    </select>
    
    <select id="getResrvInfo" parameterType="java.util.HashMap" resultType="com.siginfo.vo.PlanCRRSInfoVO">
    	SELECT TIRP.REGION_CD,
	           TIRP.INT_NO,
	           TI.INT_NM,
	           TI.GROUP_NO,
	           TIRP.RESRV_NO,
	           NVL(TIRP.RESRV_MM,0) RESRV_MM,
	           NVL(TIRP.RESRV_DD,0) RESRV_DD,
	           NVL(TIRP.RESRV_DY,0) RESRV_DY,
	           NVL(TIRP.RESRV_STRT_HH,0) RESRV_STRT_HH,
	           NVL(TIRP.RESRV_STRT_MI,0) RESRV_STRT_MI,
	           NVL(TIRP.RESRV_END_HH,0) RESRV_END_HH,
	           NVL(TIRP.RESRV_END_MI,0) RESRV_END_MI,
	           NVL(TIRP.RESRV_CONTRL_CD,0) RESRV_CONTRL_CD,
	           NVL(TIRP.RESRV_PLAN_NO,0) RESRV_PLAN_NO,
	           NVL(TIRP.COLLCT_DTIME,SYSDATE) COLLCT_DTIME
	           FROM (
	            SELECT REGION_CD,
	                   INT_NO,
	                   INT_NM,
	                   DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE,
	                   GROUP_NO
	              FROM TB_INT
	             WHERE REGION_CD = #{regionCd}
	               AND INT_NO = #{intNo}
	           ) TI, TB_INT_RESRV_PLAN TIRP
         WHERE TI.REGION_CD = TIRP.REGION_CD
           AND TI.INT_NO_SE = TIRP.INT_NO
    </select>
    
    <select id="getHolyInfo" parameterType="java.util.HashMap" resultType="com.siginfo.vo.PlanCRHDInfoVO">
         SELECT TIHP.* 
           FROM 
             (
               SELECT TIP.* 
                 FROM
                 (
                  SELECT REGION_CD,
                         INT_NO,
                         DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE
                    FROM TB_INT
                   WHERE REGION_CD = #{regionCd}
                     AND INT_NO = #{intNo}
                 ) TI, TB_INT_PLAN TIP 
                 WHERE TI.REGION_CD = TIP.REGION_CD
                   AND TI.INT_NO_SE = TIP.INT_NO
             ) A, TB_INT_HOLYDD_PLAN TIHP
        WHERE A.REGION_CD = TIHP.REGION_CD
          AND A.INT_NO = TIHP.INT_NO
          AND A.INT_PLAN_NO = TIHP.INT_PLAN_NO
    </select>
    
    <select id="getDayInfo" parameterType="java.util.HashMap" resultType="com.siginfo.vo.PlanCROPInfoVO">
         SELECT TIOP.REGION_CD,
                TIOP.INT_NO,
                TIOP.INT_PLAN_NO,
                NVL(TIOP.INT_PLAN_IDX_NO,0) INT_PLAN_IDX_NO,
                NVL(TIOP.OPER_PLAN_HH,0) OPER_PLAN_HH,
                NVL(TIOP.OPER_PLAN_MI,0) OPER_PLAN_MI,
                NVL(TIOP.INT_OPER_CYCLE_VAL,0) INT_OPER_CYCLE_VAL,
                NVL(TIOP.INT_OPER_OFFSET_VAL,0) INT_OPER_OFFSET_VAL,
                NVL(TIOP.A_RING_1_PHASE_VAL,0) A_RING_1_PHASE_VAL,
                NVL(TIOP.A_RING_2_PHASE_VAL,0) A_RING_2_PHASE_VAL,
                NVL(TIOP.A_RING_3_PHASE_VAL,0) A_RING_3_PHASE_VAL,
                NVL(TIOP.A_RING_4_PHASE_VAL,0) A_RING_4_PHASE_VAL,
                NVL(TIOP.A_RING_5_PHASE_VAL,0) A_RING_5_PHASE_VAL,
                NVL(TIOP.A_RING_6_PHASE_VAL,0) A_RING_6_PHASE_VAL,
                NVL(TIOP.A_RING_7_PHASE_VAL,0) A_RING_7_PHASE_VAL,
                NVL(TIOP.A_RING_8_PHASE_VAL,0) A_RING_8_PHASE_VAL,
                NVL(TIOP.B_RING_1_PHASE_VAL,0) B_RING_1_PHASE_VAL,
                NVL(TIOP.B_RING_2_PHASE_VAL,0) B_RING_2_PHASE_VAL,
                NVL(TIOP.B_RING_3_PHASE_VAL,0) B_RING_3_PHASE_VAL,
                NVL(TIOP.B_RING_4_PHASE_VAL,0) B_RING_4_PHASE_VAL,
                NVL(TIOP.B_RING_5_PHASE_VAL,0) B_RING_5_PHASE_VAL,
                NVL(TIOP.B_RING_6_PHASE_VAL,0) B_RING_6_PHASE_VAL,
                NVL(TIOP.B_RING_7_PHASE_VAL,0) B_RING_7_PHASE_VAL,
                NVL(TIOP.B_RING_8_PHASE_VAL,0) B_RING_8_PHASE_VAL 
           FROM (
                 SELECT TIP.* 
                   FROM
                   (
                    SELECT REGION_CD,
                           INT_NO,
                           DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE
                      FROM TB_INT
                     WHERE REGION_CD = #{regionCd} 
                       AND INT_NO = #{intNo}
                   ) TI, TB_INT_PLAN TIP 
                   WHERE TI.REGION_CD = TIP.REGION_CD
                     AND TI.INT_NO_SE = TIP.INT_NO
               ) A, TB_INT_OPER_PLAN TIOP 
          WHERE 1=1
          	AND A.REGION_CD = TIOP.REGION_CD
            <if test="planNo != null and !planNo.equals('')">
            AND A.INT_PLAN_NO = #{planNo}
            </if>
            AND A.REGION_CD = TIOP.REGION_CD
            AND A.INT_NO = TIOP.INT_NO
            AND A.INT_PLAN_NO = TIOP.INT_PLAN_NO
          ORDER BY INT_PLAN_NO, INT_PLAN_IDX_NO
    </select>
    
    <select id="getWeekInfo" parameterType="java.util.HashMap" resultType="com.siginfo.vo.PlanCRWDInfoVO">
         SELECT TIDP.* 
                 FROM     
                 (SELECT TIP.* 
                   FROM
                   (
                    SELECT REGION_CD,
                           INT_NO,
                           DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE
                      FROM TB_INT
                     WHERE REGION_CD = #{regionCd}
                       AND INT_NO = #{intNo}
                   ) TI, TB_INT_PLAN TIP 
                   WHERE TI.REGION_CD = TIP.REGION_CD
                     AND TI.INT_NO_SE = TIP.INT_NO) A, TB_INT_DY_PLAN TIDP
              WHERE A.REGION_CD = TIDP.REGION_CD
                AND A.INT_NO = TIDP.INT_NO
                AND A.INT_PLAN_NO = TIDP.INT_PLAN_NO
              ORDER BY TIDP.PLAN_DY
    </select>
    
    <select id="getPlanNo" parameterType="java.util.HashMap" resultType="java.util.HashMap">
	     SELECT A.INT_PLAN_NO
           FROM (
                 SELECT TIP.* 
                   FROM
                   (
                    SELECT REGION_CD,
                           INT_NO,
                           DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE
                      FROM TB_INT
                     WHERE REGION_CD = #{regionCd}
                       AND INT_NO = #{intNo}
                   ) TI, TB_INT_PLAN TIP 
                   WHERE TI.REGION_CD = TIP.REGION_CD
                     AND TI.INT_NO_SE = TIP.INT_NO
               ) A, TB_INT_OPER_PLAN TIOP 
          WHERE A.REGION_CD = TIOP.REGION_CD
            AND A.INT_NO = TIOP.INT_NO
            AND A.INT_PLAN_NO = TIOP.INT_PLAN_NO
          GROUP BY A.INT_PLAN_NO
          ORDER BY A.INT_PLAN_NO
    </select>
    
    <select id="getPhaseInfo" parameterType="java.util.HashMap" resultType="com.siginfo.vo.PhaseInfoVO">
    	   SELECT TI.REGION_CD,
                  TI.INT_NO,
                  TI.INT_NM,
                  (RPAD(TI.X_COORD,9,0) / 1000000) X_COORD,
                  (RPAD(TI.Y_COORD,8,0) / 1000000) Y_COORD,
                  NVL(TIP.MAP_NO,0) MAP_NO,
                  NVL(TIP.A_RING_1_PHASE_CONF_CD,0) A_RING_1_PHASE_CONF_CD,
                  NVL(TIP.A_RING_2_PHASE_CONF_CD,0) A_RING_2_PHASE_CONF_CD,
                  NVL(TIP.A_RING_3_PHASE_CONF_CD,0) A_RING_3_PHASE_CONF_CD,
                  NVL(TIP.A_RING_4_PHASE_CONF_CD,0) A_RING_4_PHASE_CONF_CD,
                  NVL(TIP.A_RING_5_PHASE_CONF_CD,0) A_RING_5_PHASE_CONF_CD,
                  NVL(TIP.A_RING_6_PHASE_CONF_CD,0) A_RING_6_PHASE_CONF_CD,
                  NVL(TIP.A_RING_7_PHASE_CONF_CD,0) A_RING_7_PHASE_CONF_CD,
                  NVL(TIP.A_RING_8_PHASE_CONF_CD,0) A_RING_8_PHASE_CONF_CD,
                  NVL(TIP.B_RING_1_PHASE_CONF_CD,0) B_RING_1_PHASE_CONF_CD,
                  NVL(TIP.B_RING_2_PHASE_CONF_CD,0) B_RING_2_PHASE_CONF_CD,
                  NVL(TIP.B_RING_3_PHASE_CONF_CD,0) B_RING_3_PHASE_CONF_CD,
                  NVL(TIP.B_RING_4_PHASE_CONF_CD,0) B_RING_4_PHASE_CONF_CD,
                  NVL(TIP.B_RING_5_PHASE_CONF_CD,0) B_RING_5_PHASE_CONF_CD,
                  NVL(TIP.B_RING_6_PHASE_CONF_CD,0) B_RING_6_PHASE_CONF_CD,
                  NVL(TIP.B_RING_7_PHASE_CONF_CD,0) B_RING_7_PHASE_CONF_CD,
                  NVL(TIP.B_RING_8_PHASE_CONF_CD,0) B_RING_8_PHASE_CONF_CD,
                  NVL(TIP.A1_FLOW_NUM,0) A1_FLOW_NUM,
                  NVL(TIP.A2_FLOW_NUM,0) A2_FLOW_NUM,
                  NVL(TIP.A3_FLOW_NUM,0) A3_FLOW_NUM,
                  NVL(TIP.A4_FLOW_NUM,0) A4_FLOW_NUM,
                  NVL(TIP.A5_FLOW_NUM,0) A5_FLOW_NUM,
                  NVL(TIP.A6_FLOW_NUM,0) A6_FLOW_NUM,
                  NVL(TIP.A7_FLOW_NUM,0) A7_FLOW_NUM,
                  NVL(TIP.A8_FLOW_NUM,0) A8_FLOW_NUM,
                  NVL(TIP.B1_FLOW_NUM,0) B1_FLOW_NUM,
                  NVL(TIP.B2_FLOW_NUM,0) B2_FLOW_NUM,
                  NVL(TIP.B3_FLOW_NUM,0) B3_FLOW_NUM,
                  NVL(TIP.B4_FLOW_NUM,0) B4_FLOW_NUM,
                  NVL(TIP.B5_FLOW_NUM,0) B5_FLOW_NUM,
                  NVL(TIP.B6_FLOW_NUM,0) B6_FLOW_NUM,
                  NVL(TIP.B7_FLOW_NUM,0) B7_FLOW_NUM,
                  NVL(TIP.B8_FLOW_NUM,0) B8_FLOW_NUM
             FROM TB_INT TI, TB_INT_PHASE TIP 
            WHERE TI.REGION_CD = TIP.REGION_CD
              AND TI.INT_NO = TIP.INT_NO
              AND TI.REGION_CD = #{regionCd}
              AND TI.INT_NO = #{intNo}
              AND TIP.MAP_NO = 0
    </select>
    
    <select id="getSigInfoPhaseDetail" parameterType="java.util.HashMap" resultType="java.util.HashMap">
        SELECT AA.REGION_CD,
               AA.INT_NO,
               AA.A_RING_1_PHASE_CONF_CD,
               AA.A_RING_2_PHASE_CONF_CD,
               AA.A_RING_3_PHASE_CONF_CD,
               AA.A_RING_4_PHASE_CONF_CD,
               AA.A_RING_5_PHASE_CONF_CD,
               AA.A_RING_6_PHASE_CONF_CD,
               AA.A_RING_7_PHASE_CONF_CD,
               AA.A_RING_8_PHASE_CONF_CD,
               AA.B_RING_1_PHASE_CONF_CD,
               AA.B_RING_2_PHASE_CONF_CD,
               AA.B_RING_3_PHASE_CONF_CD,
               AA.B_RING_4_PHASE_CONF_CD,
               AA.B_RING_5_PHASE_CONF_CD,
               AA.B_RING_6_PHASE_CONF_CD,
               AA.B_RING_7_PHASE_CONF_CD,
               AA.B_RING_8_PHASE_CONF_CD,
               TIS.A_RING_PHASE_VAL,
               TIS.B_RING_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.A_RING_1_PHASE_VAL ELSE 9999 END A_RING_1_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.A_RING_2_PHASE_VAL ELSE 9999 END A_RING_2_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.A_RING_3_PHASE_VAL ELSE 9999 END A_RING_3_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.A_RING_4_PHASE_VAL ELSE 9999 END A_RING_4_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.A_RING_5_PHASE_VAL ELSE 9999 END A_RING_5_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.A_RING_6_PHASE_VAL ELSE 9999 END A_RING_6_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.A_RING_7_PHASE_VAL ELSE 9999 END A_RING_7_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.A_RING_8_PHASE_VAL ELSE 9999 END A_RING_8_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.B_RING_1_PHASE_VAL ELSE 9999 END B_RING_1_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.B_RING_2_PHASE_VAL ELSE 9999 END B_RING_2_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.B_RING_3_PHASE_VAL ELSE 9999 END B_RING_3_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.B_RING_4_PHASE_VAL ELSE 9999 END B_RING_4_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.B_RING_5_PHASE_VAL ELSE 9999 END B_RING_5_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.B_RING_6_PHASE_VAL ELSE 9999 END B_RING_6_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.B_RING_7_PHASE_VAL ELSE 9999 END B_RING_7_PHASE_VAL,
               CASE WHEN TIS.SYS_COLLCT_DTIME > (SYSDATE - 5/24/60) THEN TIS.B_RING_8_PHASE_VAL ELSE 9999 END B_RING_8_PHASE_VAL,
               NVL(AA.MAP_NO,0) MAP_NO,
               NVL(AA.A_RING_1_PHASE_STRT_LINK_CD,'') A_RING_1_PHASE_STRT_LINK_CD,
               NVL(AA.A_RING_1_PHASE_END_LINK_CD,'') A_RING_1_PHASE_END_LINK_CD,
               NVL(AA.A_RING_2_PHASE_STRT_LINK_CD,'') A_RING_2_PHASE_STRT_LINK_CD,
               NVL(AA.A_RING_2_PHASE_END_LINK_CD,'') A_RING_2_PHASE_END_LINK_CD,
               NVL(AA.A_RING_3_PHASE_STRT_LINK_CD,'') A_RING_3_PHASE_STRT_LINK_CD,
               NVL(AA.A_RING_3_PHASE_END_LINK_CD,'') A_RING_3_PHASE_END_LINK_CD,
               NVL(AA.A_RING_4_PHASE_STRT_LINK_CD,'') A_RING_4_PHASE_STRT_LINK_CD,
               NVL(AA.A_RING_4_PHASE_END_LINK_CD,'') A_RING_4_PHASE_END_LINK_CD,
               NVL(AA.A_RING_5_PHASE_STRT_LINK_CD,'') A_RING_5_PHASE_STRT_LINK_CD,
               NVL(AA.A_RING_5_PHASE_END_LINK_CD,'') A_RING_5_PHASE_END_LINK_CD,
               NVL(AA.A_RING_6_PHASE_STRT_LINK_CD,'') A_RING_6_PHASE_STRT_LINK_CD,
               NVL(AA.A_RING_6_PHASE_END_LINK_CD,'') A_RING_6_PHASE_END_LINK_CD,
               NVL(AA.A_RING_7_PHASE_STRT_LINK_CD,'') A_RING_7_PHASE_STRT_LINK_CD,
               NVL(AA.A_RING_7_PHASE_END_LINK_CD,'') A_RING_7_PHASE_END_LINK_CD,
               NVL(AA.A_RING_8_PHASE_STRT_LINK_CD,'') A_RING_8_PHASE_STRT_LINK_CD,
               NVL(AA.A_RING_8_PHASE_END_LINK_CD,'') A_RING_8_PHASE_END_LINK_CD,
               NVL(AA.B_RING_1_PHASE_STRT_LINK_CD,'') B_RING_1_PHASE_STRT_LINK_CD,
               NVL(AA.B_RING_1_PHASE_END_LINK_CD,'') B_RING_1_PHASE_END_LINK_CD,
               NVL(AA.B_RING_2_PHASE_STRT_LINK_CD,'') B_RING_2_PHASE_STRT_LINK_CD,
               NVL(AA.B_RING_2_PHASE_END_LINK_CD,'') B_RING_2_PHASE_END_LINK_CD,
               NVL(AA.B_RING_3_PHASE_STRT_LINK_CD,'') B_RING_3_PHASE_STRT_LINK_CD,
               NVL(AA.B_RING_3_PHASE_END_LINK_CD,'') B_RING_3_PHASE_END_LINK_CD,
               NVL(AA.B_RING_4_PHASE_STRT_LINK_CD,'') B_RING_4_PHASE_STRT_LINK_CD,
               NVL(AA.B_RING_4_PHASE_END_LINK_CD,'') B_RING_4_PHASE_END_LINK_CD,
               NVL(AA.B_RING_5_PHASE_STRT_LINK_CD,'') B_RING_5_PHASE_STRT_LINK_CD,
               NVL(AA.B_RING_5_PHASE_END_LINK_CD,'') B_RING_5_PHASE_END_LINK_CD,
               NVL(AA.B_RING_6_PHASE_STRT_LINK_CD,'') B_RING_6_PHASE_STRT_LINK_CD,
               NVL(AA.B_RING_6_PHASE_END_LINK_CD,'') B_RING_6_PHASE_END_LINK_CD,
               NVL(AA.B_RING_7_PHASE_STRT_LINK_CD,'') B_RING_7_PHASE_STRT_LINK_CD,
               NVL(AA.B_RING_7_PHASE_END_LINK_CD,'') B_RING_7_PHASE_END_LINK_CD,
               NVL(AA.B_RING_8_PHASE_STRT_LINK_CD,'') B_RING_8_PHASE_STRT_LINK_CD,
               NVL(AA.B_RING_8_PHASE_END_LINK_CD,'') B_RING_8_PHASE_END_LINK_CD,
               NVL(TIS.PPC_CONTRL_FLAG,'-') PPC_CONTRL_FLAG
          FROM
            (SELECT TI.REGION_CD,
                    TI.INT_NO,
                    DECODE(TI.MAIN_INTNO,0,TI.INT_NO,TI.MAIN_INTNO) INT_NO_SE,
                    TIP.A_RING_1_PHASE_CONF_CD,
                    TIP.A_RING_2_PHASE_CONF_CD,
                    TIP.A_RING_3_PHASE_CONF_CD,
                    TIP.A_RING_4_PHASE_CONF_CD,
                    TIP.A_RING_5_PHASE_CONF_CD,
                    TIP.A_RING_6_PHASE_CONF_CD,
                    TIP.A_RING_7_PHASE_CONF_CD,
                    TIP.A_RING_8_PHASE_CONF_CD,
                    TIP.B_RING_1_PHASE_CONF_CD,
                    TIP.B_RING_2_PHASE_CONF_CD,
                    TIP.B_RING_3_PHASE_CONF_CD,
                    TIP.B_RING_4_PHASE_CONF_CD,
                    TIP.B_RING_5_PHASE_CONF_CD,
                    TIP.B_RING_6_PHASE_CONF_CD,
                    TIP.B_RING_7_PHASE_CONF_CD,
                    TIP.B_RING_8_PHASE_CONF_CD,
                    TIP.A_RING_1_PHASE_STRT_LINK_CD,
                   	TIP.A_RING_1_PHASE_END_LINK_CD,
                  	TIP.A_RING_2_PHASE_STRT_LINK_CD,
                    TIP.A_RING_2_PHASE_END_LINK_CD,
                    TIP.A_RING_3_PHASE_STRT_LINK_CD,
                    TIP.A_RING_3_PHASE_END_LINK_CD,
                    TIP.A_RING_4_PHASE_STRT_LINK_CD,
                    TIP.A_RING_4_PHASE_END_LINK_CD,
                    TIP.A_RING_5_PHASE_STRT_LINK_CD,
                    TIP.A_RING_5_PHASE_END_LINK_CD,
                    TIP.A_RING_6_PHASE_STRT_LINK_CD,
                    TIP.A_RING_6_PHASE_END_LINK_CD,
                    TIP.A_RING_7_PHASE_STRT_LINK_CD,
                    TIP.A_RING_7_PHASE_END_LINK_CD,
                    TIP.A_RING_8_PHASE_STRT_LINK_CD,
                    TIP.A_RING_8_PHASE_END_LINK_CD,
                    TIP.B_RING_1_PHASE_STRT_LINK_CD,
                    TIP.B_RING_1_PHASE_END_LINK_CD,
                    TIP.B_RING_2_PHASE_STRT_LINK_CD,
                    TIP.B_RING_2_PHASE_END_LINK_CD,
                    TIP.B_RING_3_PHASE_STRT_LINK_CD,
                    TIP.B_RING_3_PHASE_END_LINK_CD,
                    TIP.B_RING_4_PHASE_STRT_LINK_CD,
                    TIP.B_RING_4_PHASE_END_LINK_CD,
                    TIP.B_RING_5_PHASE_STRT_LINK_CD,
                    TIP.B_RING_5_PHASE_END_LINK_CD,
                    TIP.B_RING_6_PHASE_STRT_LINK_CD,
                    TIP.B_RING_6_PHASE_END_LINK_CD,
                    TIP.B_RING_7_PHASE_STRT_LINK_CD,
                    TIP.B_RING_7_PHASE_END_LINK_CD,
                    TIP.B_RING_8_PHASE_STRT_LINK_CD,
                    TIP.B_RING_8_PHASE_END_LINK_CD,
                    TIP.MAP_NO
              FROM TB_INT TI LEFT OUTER JOIN TB_INT_PHASE TIP
            ON TI.REGION_CD = TIP.REGION_CD
           AND TI.INT_NO = TIP.INT_NO
           AND TIP.MAP_NO = #{mapNo}  
         WHERE TI.REGION_CD = #{regionCd}
           AND TI.INT_NO = #{intNo}
           ) AA LEFT OUTER JOIN TB_INT_STATUS TIS
           ON AA.REGION_CD = TIS.REGION_CD
           AND AA.INT_NO_SE = TIS.INT_NO
         ORDER BY AA.REGION_CD,AA.INT_NO
    </select>
    
    <select id="getTodInfoDetail" parameterType="java.util.HashMap" resultType="java.util.HashMap">
        SELECT T1.REGION_CD,
               T1.INT_NO,
               T1.A_RING_1_PHASE_CONF_CD,
               T1.A_RING_2_PHASE_CONF_CD,
               T1.A_RING_3_PHASE_CONF_CD,
               T1.A_RING_4_PHASE_CONF_CD,
               T1.A_RING_5_PHASE_CONF_CD,
               T1.A_RING_6_PHASE_CONF_CD,
               T1.A_RING_7_PHASE_CONF_CD,
               T1.A_RING_8_PHASE_CONF_CD,
               T1.B_RING_1_PHASE_CONF_CD,
               T1.B_RING_2_PHASE_CONF_CD,
               T1.B_RING_3_PHASE_CONF_CD,
               T1.B_RING_4_PHASE_CONF_CD,
               T1.B_RING_5_PHASE_CONF_CD,
               T1.B_RING_6_PHASE_CONF_CD,
               T1.B_RING_7_PHASE_CONF_CD,
               T1.B_RING_8_PHASE_CONF_CD,
               NVL(TIS.GROUP_NO,0) GROUP_NO,
               NVL(TIS.MAP_NO,0) MAP_NO,
               T1.INT_NM,
               NVL(TO_CHAR(TIS.COLLCT_DTIME,'YYYY-MM-DD HH24:MI'),'-') COLLCT_DTIME,
               NVL(TIS.COMM_ON_OFF_FLAG,'-') COMM_ON_OFF_FLAG,
               NVL(TIS.CONTRLR_OPER_MODE_CD,'-') CONTRLR_OPER_MODE_CD,
               NVL(TIS.CONTRLR_TMDIFF_CONTRL_FLAG,'-') CONTRLR_TMDIFF_CONTRL_FLAG,
               NVL(TO_CHAR(TIS.A_RING_PHASE_VAL,0),'-') A_RING_PHASE_VAL,
               NVL(TO_CHAR(TIS.B_RING_PHASE_VAL,0),'-') B_RING_PHASE_VAL,
               NVL(TIS.SIGLIGHT_TURNOFF_FLAG,'-') SIGLIGHT_TURNOFF_FLAG,
               NVL(TIS.SIGLIGHT_BLINK_FLAG,'-') SIGLIGHT_BLINK_FLAG,
               NVL(TIS.CONTRLR_MANUAL_FLAG,'-') CONTRLR_MANUAL_FLAG,
               NVL(TO_CHAR(TIS.INT_SIG_CYCLE_CNT,'0000'),'-') INT_SIG_CYCLE_CNT,
               NVL(TO_CHAR(TIS.INT_SIG_CYCLE_LEN,'0000'),'-') INT_SIG_CYCLE_LEN,
               NVL(TIS.A_RING_1_PHASE_VAL,0) A_RING_1_PHASE_VAL,
               NVL(TIS.A_RING_2_PHASE_VAL,0) A_RING_2_PHASE_VAL,
               NVL(TIS.A_RING_3_PHASE_VAL,0) A_RING_3_PHASE_VAL,
               NVL(TIS.A_RING_4_PHASE_VAL,0) A_RING_4_PHASE_VAL,
               NVL(TIS.A_RING_5_PHASE_VAL,0) A_RING_5_PHASE_VAL,
               NVL(TIS.A_RING_6_PHASE_VAL,0) A_RING_6_PHASE_VAL,
               NVL(TIS.A_RING_7_PHASE_VAL,0) A_RING_7_PHASE_VAL,
               NVL(TIS.A_RING_8_PHASE_VAL,0) A_RING_8_PHASE_VAL,
               NVL(TIS.B_RING_1_PHASE_VAL,0) B_RING_1_PHASE_VAL,
               NVL(TIS.B_RING_2_PHASE_VAL,0) B_RING_2_PHASE_VAL,
               NVL(TIS.B_RING_3_PHASE_VAL,0) B_RING_3_PHASE_VAL,
               NVL(TIS.B_RING_4_PHASE_VAL,0) B_RING_4_PHASE_VAL,
               NVL(TIS.B_RING_5_PHASE_VAL,0) B_RING_5_PHASE_VAL,
               NVL(TIS.B_RING_6_PHASE_VAL,0) B_RING_6_PHASE_VAL,
               NVL(TIS.B_RING_7_PHASE_VAL,0) B_RING_7_PHASE_VAL,
               NVL(TIS.B_RING_8_PHASE_VAL,0) B_RING_8_PHASE_VAL,
               NVL(TO_CHAR(TIS.PPC_CONTRL_FLAG,''),'-') PPC_CONTRL_FLAG
          FROM (
                    SELECT TI.REGION_CD,
                           TI.INT_NO,
                           TI.INT_NO_SE,
                           TI.INT_NM,
                           TIP.A_RING_1_PHASE_CONF_CD,
                           TIP.A_RING_2_PHASE_CONF_CD,
                           TIP.A_RING_3_PHASE_CONF_CD,
                           TIP.A_RING_4_PHASE_CONF_CD,
                           TIP.A_RING_5_PHASE_CONF_CD,
                           TIP.A_RING_6_PHASE_CONF_CD,
                           TIP.A_RING_7_PHASE_CONF_CD,
                           TIP.A_RING_8_PHASE_CONF_CD,
                           TIP.B_RING_1_PHASE_CONF_CD,
                           TIP.B_RING_2_PHASE_CONF_CD,
                           TIP.B_RING_3_PHASE_CONF_CD,
                           TIP.B_RING_4_PHASE_CONF_CD,
                           TIP.B_RING_5_PHASE_CONF_CD,
                           TIP.B_RING_6_PHASE_CONF_CD,
                           TIP.B_RING_7_PHASE_CONF_CD,
                           TIP.B_RING_8_PHASE_CONF_CD,
                           TIP.MAP_NO
                      FROM
                    (SELECT REGION_CD,
                           INT_NO,
                           INT_NM,
                           DECODE(MAIN_INTNO,0,INT_NO,MAIN_INTNO) INT_NO_SE
                      FROM TB_INT
                      WHERE REGION_CD = #{regionCd}
                       AND INT_NO = #{intNo}
                ) TI LEFT OUTER JOIN TB_INT_PHASE TIP 
                   ON TI.REGION_CD = TIP.REGION_CD
                  AND TI.INT_NO = TIP.INT_NO
                  AND TIP.MAP_NO = #{mapNo}
                ) T1 LEFT OUTER JOIN TB_INT_STATUS TIS 
            ON T1.REGION_CD = TIS.REGION_CD
           AND T1.INT_NO_SE = TIS.INT_NO
           AND T1.MAP_NO = TIS.MAP_NO
         ORDER BY T1.REGION_CD,T1.INT_NO
    </select>
    
    <select id="getCenterList" resultType="java.util.HashMap">
        SELECT REGION_CD,
               NVL(REGION_NM,'-') REGION_NM,
               NVL(REGION_CENTER_ID,'-') REGION_CENTER_ID,
               NVL(REGION_CENTER_PASSWD,'-') REGION_CENTER_PASSWD,
               NVL(FILE_UPD_DT,'-') FILE_UPD_DT,
               NVL(SIMUL_FLAG,'-') SIMUL_FLAG,
               NVL(X_COORD,0) X_COORD,
               NVL(Y_COORD,0) Y_COORD,
               REGION_ID
          FROM TB_REGION_CENTER
         ORDER BY REGION_CD
    </select>
    
    <select id="getUpdateSigObj" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT A.REGION_CD,A.INT_NO,A.INT_NM,A.INT_LCTYPE,
		       A.INT_LAMPTYPE,A.MAIN_INTNO,A.GROUP_NO,
		       (RPAD(A.X_COORD,9,0) / 1000000) AS X_COORD,
               (RPAD(A.Y_COORD,8,0) / 1000000) AS Y_COORD,
		       A.SIGUNGU_CD,A.NETWORK_TYPE,NVL(A.MODEM_IP,'-') MODEM_IP, 
		       B.INT_MAINPHASE
		  FROM TB_INT A, TB_INT_PHASE B
		 WHERE A.REGION_CD = #{regionCd}
		   AND A.INT_NO = #{intNo}
		   AND A.REGION_CD = B.REGION_CD
		   AND A.INT_NO = B.INT_NO
    </select>
    
    <select id="getSigunguList" resultType="java.util.HashMap">
        SELECT SIGUNGU_CD, SIGUNGU_NM FROM TB_SIGUNGU 
         WHERE REGION_CD = #{regionCd}
         ORDER BY SIGUNGU_NM
    </select>
    
    <update id="updateCenter" parameterType="java.util.HashMap">
        UPDATE TB_REGION_CENTER 
           SET REGION_CD = #{regionCd},
               REGION_NM = #{regionNm},
               REGION_CENTER_ID = #{centerId},
               REGION_CENTER_PASSWD = #{centerPw},
               FILE_UPD_DT = #{updDt},
	           SIMUL_FLAG = #{simulFlag},
	           X_COORD = #{xCoord},
	           Y_COORD = #{yCoord}
	     WHERE REGION_CD = #{regionCd}
    </update>
    
    <delete id="delCenter" parameterType="java.util.HashMap">
        DELETE FROM TB_REGION_CENTER 
	     WHERE REGION_CD = #{regionCd}
    </delete>
    
    <update id="insertCenter" parameterType="java.util.HashMap">
        INSERT INTO TB_REGION_CENTER 
        (REGION_CD,REGION_NM,REGION_CENTER_ID,REGION_CENTER_PASSWD,FILE_UPD_DT,SIMUL_FLAG,X_COORD,Y_COORD,REGION_ID)
        VALUES(#{regionCd},#{regionNm},#{centerId},#{centerPw},#{updDt},#{simulFlag},#{xCoord},#{yCoord},#{regionId}) 
    </update>
    
    <!-- <select id="getEventHistory" parameterType="java.util.HashMap" resultType="java.util.HashMap">
	    SELECT TO_CHAR(A.COLLCT_DTIME,'YYYY-MM-DD HH24:MI') COLLCT_DTIME,
		       A.REGION_CD,
		       B.REGION_NM,
		       A.INT_NO,
		       C.CD_NM EVENT_CD,
		       A.COLLCT_SN
		  FROM TB_INT_EVENT_HIST A, TB_REGION_CENTER B, (SELECT * FROM TB_SIG_CODE WHERE MAIN_CD = 'EVTCD') C
		 WHERE A.REGION_CD = B.REGION_CD
		   AND TO_CHAR(A.COLLCT_DTIME,'YYYY-MM-DD HH24:MI') BETWEEN #{collctDtimeS} AND #{collctDtimeE}
		   AND A.EVENT_CD = C.SUB_CD
		 <if test='regionCd != ""'>
		   AND B.REGION_CD = #{regionCd}
		   <if test='intNo != ""'>
		   AND A.INT_NO = #{intNo}
		   </if>
		 </if>
		 <if test='eventCd1 != ""'>
		   AND A.EVENT_CD IN (#{eventCd1},#{eventCd2})
		 </if>
		 ORDER BY A.COLLCT_DTIME DESC
    </select>-->
    
    <select id="getEventHistory" parameterType="java.util.HashMap" resultType="java.util.HashMap">
	    SELECT TO_CHAR(A.COLLCT_DTIME,'YYYY-MM-DD HH24:MI') COLLCT_DTIME,
		       A.REGION_CD,
		       A.INT_NO,
		       A.EVENT_CD AS CODE,
		       A.COLLCT_SN
		  FROM TB_INT_EVENT_HIST A
		 WHERE A.COLLCT_DTIME BETWEEN TO_DATE(#{collctDtimeS}, 'YYYY-MM-DD HH24:MI') AND TO_DATE(#{collctDtimeE},'YYYY-MM-DD HH24:MI')
		 <if test='regionCd != ""'> 
		   AND A.REGION_CD = #{regionCd}
		   <if test='intNo != ""'>
		   AND A.INT_NO = #{intNo}
		   </if>
		 </if>
		 <if test='eventCd1 != ""'>
		   AND A.EVENT_CD IN (#{eventCd1}, #{eventCd2})
		 </if>
		 ORDER BY A.COLLCT_DTIME DESC
    </select>
    
    <select id="getSignalMap" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT DECODE(TI.INT_LCTYPE,1,'2004년형',2,'2010년형',TO_CHAR(TI.INT_LCTYPE) || '.알수없음') INT_LCTYPE,
               DECODE(TI.INT_LAMPTYPE,3,'3색등화기',4,'4색등화기',TO_CHAR(TI.INT_LAMPTYPE) || '.알수없음') INT_LAMPTYPE,
               DECODE(TIS.RING_NO,0,'A','B') RING_NO,
               TIS.STEP_NO,
               LPAD(TRIM(TO_CHAR(TIS.CAR1, 'XX')), 2, '0') AS CAR1, -- 3색등화기인 경우 LSU1
               LPAD(TRIM(TO_CHAR(TIS.PED1, 'XX')), 2, '0') AS PED1, -- 3색등화기인 경우 LSU2
               LPAD(TRIM(TO_CHAR(TIS.CAR2, 'XX')), 2, '0') AS CAR2, -- 3색등화기인 경우 LSU3
               LPAD(TRIM(TO_CHAR(TIS.PED2, 'XX')), 2, '0') AS PED2, -- 3색등화기인 경우 LSU4
               LPAD(TRIM(TO_CHAR(TIS.CAR3, 'XX')), 2, '0') AS CAR3, -- 3색등화기인 경우 LSU5
               LPAD(TRIM(TO_CHAR(TIS.PED3, 'XX')), 2, '0') AS PED3, -- 3색등화기인 경우 LSU6
               LPAD(TRIM(TO_CHAR(TIS.CAR4, 'XX')), 2, '0') AS CAR4, -- 3색등화기인 경우 LSU7
               LPAD(TRIM(TO_CHAR(TIS.PED4, 'XX')), 2, '0') AS PED4, -- 3색등화기인 경우 LSU8
               LPAD(TRIM(TO_CHAR(TIS.CAR5, 'XX')), 2, '0') AS CAR5, -- 3색등화기인 경우 LSU9
               LPAD(TRIM(TO_CHAR(TIS.PED5, 'XX')), 2, '0') AS PED5, -- 3색등화기인 경우 LSU10
               LPAD(TRIM(TO_CHAR(TIS.CAR6, 'XX')), 2, '0') AS CAR6, -- 3색등화기인 경우 LSU11
               LPAD(TRIM(TO_CHAR(TIS.PED6, 'XX')), 2, '0') AS PED6, -- 3색등화기인 경우 LSU12
               LPAD(TRIM(TO_CHAR(TIS.CAR7, 'XX')), 2, '0') AS CAR7, -- 3색등화기인 경우 LSU13
               LPAD(TRIM(TO_CHAR(TIS.PED7, 'XX')), 2, '0') AS PED7, -- 3색등화기인 경우 LSU14
               LPAD(TRIM(TO_CHAR(TIS.CAR8, 'XX')), 2, '0') AS CAR8, -- 3색등화기인 경우 LSU15
               LPAD(TRIM(TO_CHAR(TIS.PED8, 'XX')), 2, '0') AS PED8, -- 3색등화기인 경우 LSU16
               TIS.MIN_TM,
               TIS.MAX_TM,
               DECODE(TIS.EOP, 1, 'Y', 'N') AS EOP
          FROM TB_INT TI LEFT OUTER JOIN TB_INT_SIGNALMAP TIS
            ON TI.REGION_CD = TIS.REGION_CD
           AND TI.INT_NO = TIS.INT_NO
         WHERE TI.REGION_CD = #{regionCd}
           AND TI.INT_NO = #{intNo}
           AND TIS.PLAN_TP = #{mapNo}
         ORDER BY TIS.RING_NO,TIS.STEP_NO,TIS.PLAN_TP
    </select>
    
    <select id="getRegionCd" resultType="java.util.HashMap">
    	SELECT REGION_CD,REGION_NM FROM TB_REGION_CENTER ORDER BY REGION_NM
    </select>
    
    <select id="getIntNo" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT AA.REGION_CD,
               AA.REGION_NM,
               AA.REGION_X,
               AA.REGION_Y,
               AA.INT_NO,
               AA.INT_NM,
               BB.INT_MAINPHASE,
               AA.INT_TYPE,
               AA.INT_LCTYPE,
               AA.INT_LAMPTYPE,
               AA.X_COORD,
               AA.Y_COORD,
               AA.MAIN_INTNO,
               AA.GROUP_NO,
               AA.SIGUNGU_CD,
               AA.NETWORK_TYPE,
               NVL(AA.MODEM_IP,'-') MODEM_IP
        FROM
	        (SELECT A.REGION_CD,
	               A.REGION_NM,
	               (RPAD(A.X_COORD,9,0) / 1000000) AS REGION_X,
	               (RPAD(A.Y_COORD,8,0) / 1000000) AS REGION_Y,
	               B.INT_NO,
	               NVL(B.INT_NM,'-') INT_NM,
	               B.INT_TYPE,
	               B.INT_LCTYPE,
	               B.INT_LAMPTYPE,
	               (RPAD(B.X_COORD,9,0) / 1000000) X_COORD,
	               (RPAD(B.Y_COORD,8,0) / 1000000) Y_COORD,
	               B.MAIN_INTNO,
	               B.GROUP_NO,
	               B.SIGUNGU_CD,
	               B.NETWORK_TYPE,
	               B.MODEM_IP
	          FROM TB_REGION_CENTER A, TB_INT B
	         WHERE A.REGION_CD = B.REGION_CD
	           AND A.REGION_CD = #{regionCd}
	           AND B.X_COORD IS NOT NULL
	           AND B.Y_COORD IS NOT NULL) AA LEFT OUTER JOIN TB_INT_PHASE BB
            ON AA.REGION_CD = BB.REGION_CD
           AND AA.INT_NO = BB.INT_NO
         WHERE NVL(BB.MAP_NO,0) = 0
         ORDER BY AA.INT_NO
    </select>
    
    <select id="getEventIntNo" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT AA.REGION_CD,
               AA.REGION_NM,
               AA.REGION_X,
               AA.REGION_Y,
               AA.INT_NO,
               AA.INT_NM,
               BB.INT_MAINPHASE,
               AA.INT_TYPE,
               AA.INT_LCTYPE,
               AA.INT_LAMPTYPE,
               AA.X_COORD,
               AA.Y_COORD,
               AA.MAIN_INTNO,
               AA.GROUP_NO,
               AA.SIGUNGU_CD,
               BB.A_RING_1_PHASE_CONF_CD,
               BB.A_RING_2_PHASE_CONF_CD,
               BB.A_RING_3_PHASE_CONF_CD,
               BB.A_RING_4_PHASE_CONF_CD,
               BB.A_RING_5_PHASE_CONF_CD,
               BB.A_RING_6_PHASE_CONF_CD,
               BB.A_RING_7_PHASE_CONF_CD,
               BB.A_RING_8_PHASE_CONF_CD,
               BB.B_RING_1_PHASE_CONF_CD,
               BB.B_RING_2_PHASE_CONF_CD,
               BB.B_RING_3_PHASE_CONF_CD,
               BB.B_RING_4_PHASE_CONF_CD,
               BB.B_RING_5_PHASE_CONF_CD,
               BB.B_RING_6_PHASE_CONF_CD,
               BB.B_RING_7_PHASE_CONF_CD,
               BB.B_RING_8_PHASE_CONF_CD
        FROM
        (SELECT A.REGION_CD,
               A.REGION_NM,
               (RPAD(A.X_COORD,9,0) / 1000000) AS REGION_X,
               (RPAD(A.Y_COORD,8,0) / 1000000) AS REGION_Y,
               B.INT_NO,
               NVL(B.INT_NM,'-') INT_NM,
               B.INT_TYPE,
               B.INT_LCTYPE,
               B.INT_LAMPTYPE,
               (RPAD(B.X_COORD,9,0) / 1000000) X_COORD,
               (RPAD(B.Y_COORD,8,0) / 1000000) Y_COORD,
               B.MAIN_INTNO,
               B.GROUP_NO,
               B.SIGUNGU_CD
          FROM TB_REGION_CENTER A, TB_INT B
         WHERE A.REGION_CD = B.REGION_CD
           AND A.REGION_CD = #{regionCd}
           <if test="endIntNo != ''">AND B.INT_NO BETWEEN #{strtIntNo} AND #{endIntNo}</if>
           AND B.X_COORD IS NOT NULL
           AND B.Y_COORD IS NOT NULL) AA, TB_INT_PHASE BB
         WHERE AA.REGION_CD = BB.REGION_CD
           AND AA.INT_NO = BB.INT_NO
           AND BB.MAP_NO = 0
         ORDER BY AA.INT_NO
    </select>
    
    <select id="getEventCd" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT SUB_CD,CD_NM FROM TB_SIG_CODE WHERE MAIN_CD = 'EVTCD'
    </select>
    
    <select id="checkAddSig" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT * FROM TB_INT WHERE REGION_CD = #{regionCd} AND INT_NO = #{intNo}
    </select>
    
    <update id="updateIntStatus" parameterType="java.util.HashMap">
	    MERGE INTO 
	          TB_INT_STATUS
	        USING 
	          DUAL ON 
	          (
	            REGION_CD = #{regionCd}
	            AND INT_NO = #{intNo}
	          )
	        WHEN MATCHED THEN
	            UPDATE SET
	              COLLCT_DTIME = sysdate
	        WHEN NOT MATCHED THEN
	            INSERT (REGION_CD,INT_NO,COLLCT_DTIME,A_RING_PHASE_VAL,B_RING_PHASE_VAL,MAP_NO,INT_SIG_CYCLE_CNT,INT_SIG_CYCLE_LEN) 
	            VALUES (#{regionCd},#{intNo},sysdate,0,0,0,0,0)
    </update>
    
    <delete id="deleteSigInfo" parameterType="java.util.HashMap" >
    	DELETE FROM TB_INT WHERE REGION_CD = #{regionCd} AND INT_NO = #{intNo} 
    </delete>
    
    <update id="savePhaseInfo" parameterType="java.util.HashMap" >
    	MERGE INTO 
	          TB_INT_PHASE
	        USING 
	          DUAL ON 
	          (
	            REGION_CD = #{regionCd}
	            AND INT_NO = #{intNo}
	            AND MAP_NO = #{mapNo}
	          )
	        WHEN MATCHED THEN
	            UPDATE SET
	              ${phaseColumn} = #{phaseCd}
	        WHEN NOT MATCHED THEN
	          INSERT (REGION_CD,INT_NO,MAP_NO,${phaseColumn}) 
	          VALUES (#{regionCd},#{intNo},#{mapNo},#{phaseCd}
	        )
    </update>
    
    <update id="updateLinkCd" parameterType="java.util.HashMap" >
    	MERGE INTO 
	          TB_INT_PHASE
	        USING 
	          DUAL ON 
	          (
	            REGION_CD = #{regionCd}
	            AND INT_NO = #{intNo}
	            AND MAP_NO = #{mapNo}
	          )
	        WHEN MATCHED THEN
	            UPDATE SET
	              ${linkCd} = #{linkId}
	        WHEN NOT MATCHED THEN
	          INSERT (REGION_CD,INT_NO,MAP_NO,${linkCd}) 
	          VALUES (#{regionCd},#{intNo},#{mapNo},#{linkId}
	        )
    </update>
    
    <select id="getLinkVtx" resultType="java.util.HashMap">
    	SELECT *
		  FROM VERTEX_BLOB
		 WHERE ROUND(LINKID/10000000) IN (
		 SELECT LINKCD
		  FROM TB_SIGUNGU_LINK 
		 WHERE SIGUNGU_CD = #{sigunguCd})
    </select>
    
    <select id="getSelctLinkVtx" parameterType="java.util.HashMap" resultType="java.util.HashMap">
    	SELECT LINKID,VERTEXCNT,VERTEX FROM VERTEX_BLOB WHERE LINKID = #{linkId}
    </select>
    
    <update id="saveAddInt" parameterType="java.util.HashMap">
    	INSERT INTO TB_INT(REGION_CD,INT_NO,INT_NM,INT_TYPE,INT_LCTYPE,INT_LAMPTYPE,MAIN_INTNO,GROUP_NO,X_COORD,Y_COORD,SIGUNGU_CD,UPD_DTIME,NETWORK_TYPE,MODEM_IP) 
    	VALUES(#{regionCd},#{intNo},#{intNm},#{intType},#{intLcType},#{intLampType},#{mainIntNo},#{grpNo},#{xCoord},#{yCoord},#{sigunguCd},sysdate,#{intNetworkType},#{intModemIp})
    </update>
    
    <update id="saveAddIntPhase" parameterType="java.util.HashMap">
    	INSERT INTO TB_INT_PHASE(REGION_CD,INT_NO,MAP_NO,INT_MAINPHASE,A_RING_1_PHASE_CONF_CD,B_RING_1_PHASE_CONF_CD) VALUES(#{regionCd},#{intNo},#{intMainphase},0,'S000180','S180000')
    </update>
    
    <update id="saveAddIntStatus" parameterType="java.util.HashMap">
    	INSERT INTO TB_INT_STATUS(REGION_CD,INT_NO,COLLCT_DTIME,A_RING_PHASE_VAL,B_RING_PHASE_VAL,MAP_NO,INT_SIG_CYCLE_CNT,INT_SIG_CYCLE_LEN,GROUP_NO) VALUES(#{regionCd},#{intNo},SYSDATE,0,0,0,0,0,#{grpNo})
    </update>
    
     <update id="updateAddInt" parameterType="java.util.HashMap" >
    	UPDATE TB_INT SET REGION_CD = #{regionCd},
    	  				  INT_NO = #{intNo},
    	                  INT_NM = #{intNm},
    	                  INT_TYPE = #{intType},
    	                  INT_LCTYPE = #{intLcType},
    	                  INT_LAMPTYPE = #{intLampType},
    	                  MAIN_INTNO = #{mainIntNo},
       	                  GROUP_NO = #{grpNo},
    	                  X_COORD = #{xCoord},
    	                  Y_COORD = #{yCoord},
    	                  SIGUNGU_CD = #{sigunguCd},
    	                  UPD_DTIME = SYSDATE,
    	                  NETWORK_TYPE = #{intNetworkType},
    	                  MODEM_IP = #{intModemIp}
    	 WHERE REGION_CD = #{regionCd} AND INT_NO = #{intNo}
    </update>
    
    <update id="updateAddMainphase" parameterType="java.util.HashMap" >
    	UPDATE TB_INT_PHASE SET INT_MAINPHASE = #{intMainphase}
    	 WHERE REGION_CD = #{regionCd} AND INT_NO = #{intNo}
    </update>
    
    <delete id="deleteAddIntPhase" parameterType="java.util.HashMap">
    	DELETE FROM TB_INT_PHASE WHERE REGION_CD = #{regionCd} AND INT_NO = #{intNo}
    </delete>
    
    <delete id="deleteAddIntStatus" parameterType="java.util.HashMap">
    	DELETE FROM TB_INT_STATUS WHERE REGION_CD = #{regionCd} AND INT_NO = #{intNo}
    </delete>
    
    <select id="getCoordData" parameterType="java.util.HashMap" resultType="java.util.HashMap">
	    SELECT A.REGION_CD,
		       A.INT_NO,
		       A.MAP_NO,
		       (RPAD(B.X_COORD,9,0) / 1000000) X_COORD,
		       (RPAD(B.Y_COORD,8,0) / 1000000) Y_COORD,
		       A.A_RING_1_PHASE_CONF_CD,
		       A.A_RING_2_PHASE_CONF_CD,
		       A.A_RING_3_PHASE_CONF_CD,
		       A.A_RING_4_PHASE_CONF_CD,
		       A.A_RING_5_PHASE_CONF_CD,
		       A.A_RING_6_PHASE_CONF_CD,
		       A.A_RING_7_PHASE_CONF_CD,
		       A.A_RING_8_PHASE_CONF_CD,
		       A.B_RING_1_PHASE_CONF_CD,
		       A.B_RING_2_PHASE_CONF_CD,
		       A.B_RING_3_PHASE_CONF_CD,
		       A.B_RING_4_PHASE_CONF_CD,
		       A.B_RING_5_PHASE_CONF_CD,
		       A.B_RING_6_PHASE_CONF_CD,
		       A.B_RING_7_PHASE_CONF_CD,
		       A.B_RING_8_PHASE_CONF_CD
		  FROM TB_INT_PHASE A, TB_INT B
		 WHERE A.REGION_CD = B.REGION_CD
		   AND A.INT_NO = B.INT_NO
		 ORDER BY 1,2
    </select>
    
    <update id="setSigCoord" parameterType="java.util.HashMap">
    	INSERT INTO TB_COORD_TO_ANGLE VALUES(
    	     #{regionCd},#{intNo},#{mapNo},#{aRingPhase1StrtX},#{aRingPhase1StrtY},#{aRingPhase1MiddleX},#{aRingPhase1MiddleY},#{aRingPhase1EndX},#{aRingPhase1EndY},
			 #{aRingPhase2StrtX},#{aRingPhase2StrtY},#{aRingPhase2MiddleX},#{aRingPhase2MiddleY},#{aRingPhase2EndX},#{aRingPhase2EndY},#{aRingPhase3StrtX},#{aRingPhase3StrtY},
			 #{aRingPhase3MiddleX},#{aRingPhase3MiddleY},#{aRingPhase3EndX},#{aRingPhase3EndY},#{aRingPhase4StrtX},#{aRingPhase4StrtY},#{aRingPhase4MiddleX},#{aRingPhase4MiddleY},
			 #{aRingPhase4EndX},#{aRingPhase4EndY},#{aRingPhase5StrtX},#{aRingPhase5StrtY},#{aRingPhase5MiddleX},#{aRingPhase5MiddleY},#{aRingPhase5EndX},#{aRingPhase5EndY},
			 #{aRingPhase6StrtX},#{aRingPhase6StrtY},#{aRingPhase6MiddleX},#{aRingPhase6MiddleY},#{aRingPhase6EndX},#{aRingPhase6EndY},#{aRingPhase7StrtX},#{aRingPhase7StrtY},
			 #{aRingPhase7MiddleX},#{aRingPhase7MiddleY},#{aRingPhase7EndX},#{aRingPhase7EndY},#{aRingPhase8StrtX},#{aRingPhase8StrtY},#{aRingPhase8MiddleX},#{aRingPhase8MiddleY},
			 #{aRingPhase8EndX},#{aRingPhase8EndY},#{bRingPhase1StrtX},#{bRingPhase1StrtY},#{bRingPhase1MiddleX},#{bRingPhase1MiddleY},#{bRingPhase1EndX},#{bRingPhase1EndY},
			 #{bRingPhase2StrtX},#{bRingPhase2StrtY},#{bRingPhase2MiddleX},#{bRingPhase2MiddleY},#{bRingPhase2EndX},#{bRingPhase2EndY},#{bRingPhase3StrtX},#{bRingPhase3StrtY},
			 #{bRingPhase3MiddleX},#{bRingPhase3MiddleY},#{bRingPhase3EndX},#{bRingPhase3EndY},#{bRingPhase4StrtX},#{bRingPhase4StrtY},#{bRingPhase4MiddleX},#{bRingPhase4MiddleY},
			 #{bRingPhase4EndX},#{bRingPhase4EndY},#{bRingPhase5StrtX},#{bRingPhase5StrtY},#{bRingPhase5MiddleX},#{bRingPhase5MiddleY},#{bRingPhase5EndX},#{bRingPhase5EndY},
			 #{bRingPhase6StrtX},#{bRingPhase6StrtY},#{bRingPhase6MiddleX},#{bRingPhase6MiddleY},#{bRingPhase6EndX},#{bRingPhase6EndY},#{bRingPhase7StrtX},#{bRingPhase7StrtY},
			 #{bRingPhase7MiddleX},#{bRingPhase7MiddleY},#{bRingPhase7EndX},#{bRingPhase7EndY},#{bRingPhase8StrtX},#{bRingPhase8StrtY},#{bRingPhase8MiddleX},#{bRingPhase8MiddleY},
			 #{bRingPhase8EndX},#{bRingPhase8EndY})
    </update>
    
    <!-- 서울 신호좌표데이터 각도데이터로 변경 -->
    <select id="transAngle" resultType="java.util.HashMap">
    	SELECT *
		  FROM TB_COORD_TO_ANGLE
    </select>
    
    <select id="transAngle_bak" resultType="java.util.HashMap">
    	SELECT B.REGION_CD,B.INT_NO,A.MAP_NO,A.INT_MAINPHASE,(B.X_COORD/10000000) CENTER_X,(B.Y_COORD/10000000) CENTER_Y,
		       A.A_RING_1_PHASE_STRT_X,A.A_RING_1_PHASE_STRT_Y,A.A_RING_1_PHASE_MIDDLE_X,A.A_RING_1_PHASE_MIDDLE_Y,A.A_RING_1_PHASE_END_X,A.A_RING_1_PHASE_END_Y,
		       A.A_RING_2_PHASE_STRT_X,A.A_RING_2_PHASE_STRT_Y,A.A_RING_2_PHASE_MIDDLE_X,A.A_RING_2_PHASE_MIDDLE_Y,A.A_RING_2_PHASE_END_X,A.A_RING_2_PHASE_END_Y,
		       A.A_RING_3_PHASE_STRT_X,A.A_RING_3_PHASE_STRT_Y,A.A_RING_3_PHASE_MIDDLE_X,A.A_RING_3_PHASE_MIDDLE_Y,A.A_RING_3_PHASE_END_X,A.A_RING_3_PHASE_END_Y,
		       A.A_RING_4_PHASE_STRT_X,A.A_RING_4_PHASE_STRT_Y,A.A_RING_4_PHASE_MIDDLE_X,A.A_RING_4_PHASE_MIDDLE_Y,A.A_RING_4_PHASE_END_X,A.A_RING_4_PHASE_END_Y,
		       A.A_RING_5_PHASE_STRT_X,A.A_RING_5_PHASE_STRT_Y,A.A_RING_5_PHASE_MIDDLE_X,A.A_RING_5_PHASE_MIDDLE_Y,A.A_RING_5_PHASE_END_X,A.A_RING_5_PHASE_END_Y,
		       A.A_RING_6_PHASE_STRT_X,A.A_RING_6_PHASE_STRT_Y,A.A_RING_6_PHASE_MIDDLE_X,A.A_RING_6_PHASE_MIDDLE_Y,A.A_RING_6_PHASE_END_X,A.A_RING_6_PHASE_END_Y,
		       A.A_RING_7_PHASE_STRT_X,A.A_RING_7_PHASE_STRT_Y,A.A_RING_7_PHASE_MIDDLE_X,A.A_RING_7_PHASE_MIDDLE_Y,A.A_RING_7_PHASE_END_X,A.A_RING_7_PHASE_END_Y,
		       A.A_RING_8_PHASE_STRT_X,A.A_RING_8_PHASE_STRT_Y,A.A_RING_8_PHASE_MIDDLE_X,A.A_RING_8_PHASE_MIDDLE_Y,A.A_RING_8_PHASE_END_X,A.A_RING_8_PHASE_END_Y,
		       A.B_RING_1_PHASE_STRT_X,A.B_RING_1_PHASE_STRT_Y,A.B_RING_1_PHASE_MIDDLE_X,A.B_RING_1_PHASE_MIDDLE_Y,A.B_RING_1_PHASE_END_X,A.B_RING_1_PHASE_END_Y,
		       A.B_RING_2_PHASE_STRT_X,A.B_RING_2_PHASE_STRT_Y,A.B_RING_2_PHASE_MIDDLE_X,A.B_RING_2_PHASE_MIDDLE_Y,A.B_RING_2_PHASE_END_X,A.B_RING_2_PHASE_END_Y,
		       A.B_RING_3_PHASE_STRT_X,A.B_RING_3_PHASE_STRT_Y,A.B_RING_3_PHASE_MIDDLE_X,A.B_RING_3_PHASE_MIDDLE_Y,A.B_RING_3_PHASE_END_X,A.B_RING_3_PHASE_END_Y,
		       A.B_RING_4_PHASE_STRT_X,A.B_RING_4_PHASE_STRT_Y,A.B_RING_4_PHASE_MIDDLE_X,A.B_RING_4_PHASE_MIDDLE_Y,A.B_RING_4_PHASE_END_X,A.B_RING_4_PHASE_END_Y,
		       A.B_RING_5_PHASE_STRT_X,A.B_RING_5_PHASE_STRT_Y,A.B_RING_5_PHASE_MIDDLE_X,A.B_RING_5_PHASE_MIDDLE_Y,A.B_RING_5_PHASE_END_X,A.B_RING_5_PHASE_END_Y,
		       A.B_RING_6_PHASE_STRT_X,A.B_RING_6_PHASE_STRT_Y,A.B_RING_6_PHASE_MIDDLE_X,A.B_RING_6_PHASE_MIDDLE_Y,A.B_RING_6_PHASE_END_X,A.B_RING_6_PHASE_END_Y,
		       A.B_RING_7_PHASE_STRT_X,A.B_RING_7_PHASE_STRT_Y,A.B_RING_7_PHASE_MIDDLE_X,A.B_RING_7_PHASE_MIDDLE_Y,A.B_RING_7_PHASE_END_X,A.B_RING_7_PHASE_END_Y,
		       A.B_RING_8_PHASE_STRT_X,A.B_RING_8_PHASE_STRT_Y,A.B_RING_8_PHASE_MIDDLE_X,A.B_RING_8_PHASE_MIDDLE_Y,A.B_RING_8_PHASE_END_X,A.B_RING_8_PHASE_END_Y,
		       A.A1_FLOW_NUM,A.A2_FLOW_NUM,A.A3_FLOW_NUM,A.A4_FLOW_NUM,A.A5_FLOW_NUM,A.A6_FLOW_NUM,A.A7_FLOW_NUM,A.A8_FLOW_NUM,
		       A.B1_FLOW_NUM,A.B2_FLOW_NUM,A.B3_FLOW_NUM,A.B4_FLOW_NUM,A.B5_FLOW_NUM,A.B6_FLOW_NUM,A.B7_FLOW_NUM,A.B8_FLOW_NUM
		  FROM TB_COORD_TO_ANGLE A, TB_INT B 
		 WHERE A.REGION_CD = B.REGION_CD AND A.INT_NO = B.INT_NO
    </select>
    
    <update id="insertPhase" parameterType="java.util.HashMap">
    	MERGE INTO
          TB_INT_PHASE
        USING
          DUAL ON
          (
            REGION_CD = #{regionCd}
            AND INT_NO = #{intNo}
            AND MAP_NO = #{mapNo}
          )
        WHEN MATCHED THEN
            UPDATE SET INT_MAINPHASE = #{intMainphase}, A_RING_1_PHASE_CONF_CD = #{aRing1Phase},A_RING_2_PHASE_CONF_CD = #{aRing2Phase},A_RING_3_PHASE_CONF_CD = #{aRing3Phase},
              A_RING_4_PHASE_CONF_CD = #{aRing4Phase},A_RING_5_PHASE_CONF_CD = #{aRing5Phase},A_RING_6_PHASE_CONF_CD = #{aRing6Phase},A_RING_7_PHASE_CONF_CD = #{aRing7Phase},
              A_RING_8_PHASE_CONF_CD = #{aRing8Phase},B_RING_1_PHASE_CONF_CD = #{bRing1Phase},B_RING_2_PHASE_CONF_CD = #{bRing2Phase},B_RING_3_PHASE_CONF_CD = #{bRing3Phase},
              B_RING_4_PHASE_CONF_CD = #{bRing4Phase},B_RING_5_PHASE_CONF_CD = #{bRing5Phase},B_RING_6_PHASE_CONF_CD = #{bRing6Phase},B_RING_7_PHASE_CONF_CD = #{bRing7Phase},
              B_RING_8_PHASE_CONF_CD = #{bRing8Phase},A1_FLOW_NUM = #{a1FlowNum},A2_FLOW_NUM = #{a2FlowNum},A3_FLOW_NUM = #{a3FlowNum},A4_FLOW_NUM = #{a4FlowNum}, A5_FLOW_NUM = #{a5FlowNum},
              A6_FLOW_NUM = #{a6FlowNum},A7_FLOW_NUM = #{a7FlowNum},A8_FLOW_NUM = #{a8FlowNum},B1_FLOW_NUM = #{b1FlowNum},B2_FLOW_NUM = #{b2FlowNum},B3_FLOW_NUM = #{b3FlowNum},
              B4_FLOW_NUM = #{b4FlowNum}, B5_FLOW_NUM = #{b5FlowNum},B6_FLOW_NUM = #{b6FlowNum},B7_FLOW_NUM = #{b7FlowNum},B8_FLOW_NUM = #{b8FlowNum},BATCH_JOB_DEL = 'Y'
        WHEN NOT MATCHED THEN
            INSERT (REGION_CD,INT_NO,MAP_NO,INT_MAINPHASE,A_RING_1_PHASE_CONF_CD,A_RING_2_PHASE_CONF_CD,A_RING_3_PHASE_CONF_CD,A_RING_4_PHASE_CONF_CD,A_RING_5_PHASE_CONF_CD,A_RING_6_PHASE_CONF_CD,
          		    A_RING_7_PHASE_CONF_CD,A_RING_8_PHASE_CONF_CD,B_RING_1_PHASE_CONF_CD,B_RING_2_PHASE_CONF_CD,B_RING_3_PHASE_CONF_CD,B_RING_4_PHASE_CONF_CD,B_RING_5_PHASE_CONF_CD,
                    B_RING_6_PHASE_CONF_CD,B_RING_7_PHASE_CONF_CD,B_RING_8_PHASE_CONF_CD,A1_FLOW_NUM,A2_FLOW_NUM,A3_FLOW_NUM,A4_FLOW_NUM,A5_FLOW_NUM,A6_FLOW_NUM,A7_FLOW_NUM,A8_FLOW_NUM,
                    B1_FLOW_NUM,B2_FLOW_NUM,B3_FLOW_NUM,B4_FLOW_NUM,B5_FLOW_NUM,B6_FLOW_NUM,B7_FLOW_NUM,B8_FLOW_NUM,BATCH_JOB_DEL)
            VALUES(#{regionCd},#{intNo},#{mapNo},#{intMainphase},#{aRing1Phase},#{aRing2Phase},#{aRing3Phase},#{aRing4Phase},#{aRing5Phase},#{aRing6Phase},#{aRing7Phase},#{aRing8Phase},
                   #{bRing1Phase},#{bRing2Phase},#{bRing3Phase},#{bRing4Phase},#{bRing5Phase},#{bRing6Phase},#{bRing7Phase},#{bRing8Phase},
                   #{a1FlowNum},#{a2FlowNum},#{a3FlowNum},#{a4FlowNum},#{a5FlowNum},#{a6FlowNum},#{a7FlowNum},#{a8FlowNum},
                   #{b1FlowNum},#{b2FlowNum},#{b3FlowNum},#{b4FlowNum},#{b5FlowNum},#{b6FlowNum},#{b7FlowNum},#{b8FlowNum},'Y')
    </update>
    
    <update id="setSigunguData" parameterType="java.util.HashMap">
        INSERT INTO TB_SIGUNGU VALUES(#{regionCd},#{sigunguCd},#{sigunguNm},#{intNo},SYSDATE) 
    </update>
    
    <update id="addLinkVertex" parameterType="java.util.HashMap">
        INSERT INTO VERTEX_BLOB VALUES(#{linkId},#{vertexCnt},#{vertex}) 
    </update>
    
    <update id="updatePhaseInfoList" parameterType="java.util.HashMap">
    	INSERT INTO TB_COORD_TO_ANGLE VALUES
    	(
        	#{regionCd},#{intNo},#{mapNo},#{intMainphase},
        	#{aRing1PhaseStrtX},#{aRing1PhaseStrtY},#{aRing1PhaseMiddleX},#{aRing1PhaseMiddleY},#{aRing1PhaseEndX},#{aRing1PhaseEndY},
        	#{aRing2PhaseStrtX},#{aRing2PhaseStrtY},#{aRing2PhaseMiddleX},#{aRing2PhaseMiddleY},#{aRing2PhaseEndX},#{aRing2PhaseEndY},
        	#{aRing3PhaseStrtX},#{aRing3PhaseStrtY},#{aRing3PhaseMiddleX},#{aRing3PhaseMiddleY},#{aRing3PhaseEndX},#{aRing3PhaseEndY},
        	#{aRing4PhaseStrtX},#{aRing4PhaseStrtY},#{aRing4PhaseMiddleX},#{aRing4PhaseMiddleY},#{aRing4PhaseEndX},#{aRing4PhaseEndY},
        	#{aRing5PhaseStrtX},#{aRing5PhaseStrtY},#{aRing5PhaseMiddleX},#{aRing5PhaseMiddleY},#{aRing5PhaseEndX},#{aRing5PhaseEndY},
        	#{aRing6PhaseStrtX},#{aRing6PhaseStrtY},#{aRing6PhaseMiddleX},#{aRing6PhaseMiddleY},#{aRing6PhaseEndX},#{aRing6PhaseEndY},
        	#{aRing7PhaseStrtX},#{aRing7PhaseStrtY},#{aRing7PhaseMiddleX},#{aRing7PhaseMiddleY},#{aRing7PhaseEndX},#{aRing7PhaseEndY},
        	#{aRing8PhaseStrtX},#{aRing8PhaseStrtY},#{aRing8PhaseMiddleX},#{aRing8PhaseMiddleY},#{aRing8PhaseEndX},#{aRing8PhaseEndY},
        	#{bRing1PhaseStrtX},#{bRing1PhaseStrtY},#{bRing1PhaseMiddleX},#{bRing1PhaseMiddleY},#{bRing1PhaseEndX},#{bRing1PhaseEndY},
        	#{bRing2PhaseStrtX},#{bRing2PhaseStrtY},#{bRing2PhaseMiddleX},#{bRing2PhaseMiddleY},#{bRing2PhaseEndX},#{bRing2PhaseEndY},
        	#{bRing3PhaseStrtX},#{bRing3PhaseStrtY},#{bRing3PhaseMiddleX},#{bRing3PhaseMiddleY},#{bRing3PhaseEndX},#{bRing3PhaseEndY},
        	#{bRing4PhaseStrtX},#{bRing4PhaseStrtY},#{bRing4PhaseMiddleX},#{bRing4PhaseMiddleY},#{bRing4PhaseEndX},#{bRing4PhaseEndY},
        	#{bRing5PhaseStrtX},#{bRing5PhaseStrtY},#{bRing5PhaseMiddleX},#{bRing5PhaseMiddleY},#{bRing5PhaseEndX},#{bRing5PhaseEndY},
        	#{bRing6PhaseStrtX},#{bRing6PhaseStrtY},#{bRing6PhaseMiddleX},#{bRing6PhaseMiddleY},#{bRing6PhaseEndX},#{bRing6PhaseEndY},
        	#{bRing7PhaseStrtX},#{bRing7PhaseStrtY},#{bRing7PhaseMiddleX},#{bRing7PhaseMiddleY},#{bRing7PhaseEndX},#{bRing7PhaseEndY},
        	#{bRing8PhaseStrtX},#{bRing8PhaseStrtY},#{bRing8PhaseMiddleX},#{bRing8PhaseMiddleY},#{bRing8PhaseEndX},#{bRing8PhaseEndY},
        	#{a1FlowNum},#{a2FlowNum},#{a3FlowNum},#{a4FlowNum},#{a5FlowNum},#{a6FlowNum},#{a7FlowNum},#{a8FlowNum},
        	#{b1FlowNum},#{b2FlowNum},#{b3FlowNum},#{b4FlowNum},#{b5FlowNum},#{b6FlowNum},#{b7FlowNum},#{b8FlowNum}
    	)
    </update>
    
    <delete id="deleteCoordToAngle">
    	DELETE FROM TB_COORD_TO_ANGLE
    </delete>
    
    <update id="updateIntInfoList" parameterType="java.util.HashMap">
    	MERGE INTO
          TB_INT
        USING
          DUAL ON
          (
            REGION_CD = #{regionCd}
            AND INT_NO = #{intNo}
          )
        WHEN MATCHED THEN
            UPDATE SET INT_NM = #{intNm},INT_TYPE = #{intType},INT_LCTYPE = #{intLcType},INT_LAMPTYPE = #{intLampType},MAIN_INTNO = #{mainIntNo},
              		   GROUP_NO = #{groupNo},X_COORD = #{xCoord},Y_COORD = #{yCoord}, SIGUNGU_CD = #{sigunguCd}, UPD_DTIME = SYSDATE,BATCH_JOB_DEL = 'Y'
        WHEN NOT MATCHED THEN
            INSERT (REGION_CD,INT_NO,INT_NM,INT_TYPE,INT_LCTYPE,INT_LAMPTYPE,MAIN_INTNO,GROUP_NO,X_COORD,Y_COORD,UPD_DTIME,BATCH_JOB_DEL,SIGUNGU_CD)
            VALUES(#{regionCd},#{intNo},#{intNm},#{intType},#{intLcType},#{intLampType},#{mainIntNo},#{groupNo},#{xCoord},#{yCoord},SYSDATE,'Y',#{sigunguCd})
    </update>
    
    <delete id="intPhaseInfoDelete" parameterType="java.util.HashMap" >
    	DELETE FROM ${tableId} WHERE REGION_CD = #{regionCd} AND BATCH_JOB_DEL = 'N'
    </delete>
    
    <update id="jobDelUpdate" parameterType="java.util.HashMap" >
    	UPDATE ${tableId} SET BATCH_JOB_DEL = 'N' WHERE REGION_CD = #{regionCd}
    </update>
    
    <update id="updateSigunguCd" parameterType="java.util.HashMap" >
    	UPDATE TB_INT SET SIGUNGU_CD = #{sigunguCd} WHERE REGION_CD = #{regionCd} AND INT_NO = #{intNo}
    </update>
    
    <select id="getCvibInfo" parameterType="java.util.HashMap" resultType="java.util.HashMap">
   		SELECT REGION_CD,INT_NO,TO_CHAR(COLLECT_TIME,'YYYY-MM-DD HH24:MI:HH') COLLECT_TIME,
                  DECODE(OPR_TRANS,1,'ON',0,'OFF') OPR_TRANS,
                  DECODE(OPR_IND,1,'ON',0,'OFF') OPR_IND,
                  DECODE(OPR_TURNOFF,1,'ON',0,'OFF') OPR_TURNOFF,
                  DECODE(OPR_BLINK,1,'ON',0,'OFF') OPR_BLINK,
                  DECODE(OPR_MANUAL,1,'ON',0,'OFF') OPR_MANUAL,
                  DECODE(ERR_BUS,0,'정상',1,'이상') ERR_BUS,
                  DECODE(ERR_DB,0,'정상',1,'이상') ERR_DB,
                  DECODE(ERR_SCU,0,'정상',1,'이상') ERR_SCU,
                  DECODE(ERR_CENTER,0,'정상',1,'이상') ERR_CENTER,
                  DECODE(ERR_CONT,0,'정상',1,'이상') ERR_CONT,
                  CYCLE_COUNTER,
                  DATA_COUNT,
                  TO_CHAR(INT_TIME,'YYYY-MM-DD HH24:MI:SS') INT_TIME,
                  LIGHT_STS1,LIGHT_STS2,LIGHT_STS3,LIGHT_STS4,LIGHT_STS5,LIGHT_STS6,LIGHT_STS7,LIGHT_STS8
             FROM TB_INT_CVIB_STATUS
            WHERE REGION_CD IN 
           		<foreach collection="regionCdArr" item="regionCd" open="(" close=")" separator=",">
      	 		#{regionCd}
	        	</foreach>
              AND INT_NO IN
              <foreach collection="intNoArr" item="intNo" open="(" close=")" separator=",">
      	 		#{intNo}
	          </foreach>
    </select>
    
    <select id="getCvibInfoDetail" parameterType="java.util.HashMap" resultType="java.util.HashMap">
	    SELECT REGION_CD,INT_NO,
			   DECODE(MAP_DIR,1,'북',2,'동',3,'남',4,'서',5,'북동',6,'남동',7,'남서',8,'북서') MAP_DIR, 
			   OUTPUT_TP, WALK, TM_FLAG, LIGHT_STS, DISP_TM, REMAIN_TM
			  FROM TB_INT_CVIB_STATUS_MAP
			 WHERE REGION_CD = #{regionCd}
			   AND INT_NO = #{intNo}
    </select>
</mapper>