<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="Adapter">
  <statement id="selectListAdapterGroup" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
     SELECT   ADPTRBZWKGROUPNAME AS "ADPTRBZWKGROUPNAME"
		, ADPTRMSGPTRNCD     AS "ADPTRMSGPTRNCD"
		, EAIBZWKDSTCD       AS "EAIBZWKDSTCD"
		, ADPTRCD            AS "ADPTRCD"
		, ADPTRMSGDSTCD      AS "ADPTRMSGDSTCD"
		, ADPTRIODSTCD       AS "ADPTRIODSTCD"
		, REFCLSNAME         AS "REFCLSNAME"
		, SNDRCVHMSLOGYN     AS "SNDRCVHMSLOGYN"
		, ADPTRUSEYN         AS "ADPTRUSEYN"
		, SPCFCLUUSEYN       AS "SPCFCLUUSEYN"
		, ADPTRBZWKGROUPDESC AS "ADPTRBZWKGROUPDESC"
		, OSIDINSTINO        AS "OSIDINSTINO"
		, BIDINTERFACE        AS "BIDINTERFACE"
	   FROM $schemaId$.TSEAIAD01
	 WHERE ADPTRBZWKGROUPNAME = #ADPTRBZWKGROUPNAME#
  </statement>
  
  <statement id="delete" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
    DELETE FROM $schemaId$.TSEAIAD01 WHERE ADPTRBZWKGROUPNAME = #ADPTRBZWKGROUPNAME#
  </statement>  
  
  <statement id="checkAdapterGroup" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
    SELECT COUNT(*) 
		  FROM $schemaId$.TSEAIAD01
	   WHERE ADPTRBZWKGROUPNAME = #ADPTRBZWKGROUPNAME#
  </statement>
  
   <statement id="checkAdapterNickName" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
    SELECT COUNT(*) 
		  FROM $schemaId$.TSEAIAD01
	   WHERE ADPTRNICKNAME = #ADPTRNICKNAME#
	   AND ADPTRBZWKGROUPNAME &lt;&gt; #ADPTRBZWKGROUPNAME#
  </statement>

  <statement id="selectListAdapter" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
     SELECT   AD02.ADPTRBZWKGROUPNAME AS "ADPTRBZWKGROUPNAME"
			, AD02.ADPTRBZWKNAME      AS "ADPTRBZWKNAME"
			, AD02.EAISEVRINSTNCNAME  AS "EAISEVRINSTNCNAME"
			, AD02.LSTNERCLSNAME      AS "LSTNERCLSNAME"
			, AD02.TESTCLSNAME        AS "TESTCLSNAME"
			, AD02.PRPTYGROUPNAME     AS "PRPTYGROUPNAME"
			, AD02.ADPTRDESC          AS "ADPTRDESC"
			, AD14.PRPTYGROUPDESC	  AS "PRPTYGROUPDESC"
	   FROM $schemaId$.TSEAIAD02 AD02 LEFT OUTER JOIN $schemaId$.TSEAIAD14 AD14
	   ON AD02.PRPTYGROUPNAME = AD14.PRPTYGROUPNAME
	 WHERE AD02.ADPTRBZWKGROUPNAME = #ADPTRBZWKGROUPNAME#
	 ORDER BY AD02.PRPTYGROUPNAME
  </statement>     
  
  <statement id="insertAdapter" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		INSERT INTO $schemaId$.TSEAIAD02 ( 
		     ADPTRBZWKGROUPNAME, ADPTRBZWKNAME, EAISEVRINSTNCNAME, LSTNERCLSNAME, 
		     TESTCLSNAME, PRPTYGROUPNAME, ADPTRDESC 
		 ) VALUES ( 
		     #ADPTRBZWKGROUPNAME#, #ADPTRBZWKNAME#, #EAISEVRINSTNCNAME#, #LSTNERCLSNAME#, 
		     #TESTCLSNAME#, #PRPTYGROUPNAME#, #ADPTRDESC#
		 )		    
  </statement>

   
  <statement id="deleteAdapterForAdapterGroup" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
    DELETE FROM $schemaId$.TSEAIAD02 WHERE ADPTRBZWKGROUPNAME = #ADPTRBZWKGROUPNAME#
  </statement>

    <statement id="selectListAll" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
	  SELECT 
		 ADPTRBZWKGROUPNAME     "ADPTRBZWKGROUPNAME"    
		,ADPTRMSGPTRNCD         "ADPTRMSGPTRNCD"        
		,EAIBZWKDSTCD           "EAIBZWKDSTCD"          
		,ADPTRCD                "ADPTRCD"               
		,ADPTRMSGDSTCD          "ADPTRMSGDSTCD"         
		,ADPTRIODSTCD           "ADPTRIODSTCD"          
		,REFCLSNAME             "REFCLSNAME"            
		,SNDRCVHMSLOGYN         "SNDRCVHMSLOGYN"        
		,ADPTRUSEYN             "ADPTRUSEYN"            
		,SPCFCLUUSEYN           "SPCFCLUUSEYN"          
		,ADPTRBZWKGROUPDESC     "ADPTRBZWKGROUPDESC"    
		,OSIDINSTINO            "OSIDINSTINO"           
		,EAILASTAMNDYMS         "EAILASTAMNDYMS"        
		,OSIDINSTIYN            "OSIDINSTIYN"           
		,OSIDINSTIBZWKRSEMPNAME "OSIDINSTIBZWKRSEMPNAME"
		,OSIDINSTITELNO         "OSIDINSTITELNO"        
		,MONIUSEYN              "MONIUSEYN"             
		,MONICNDNCTNT           "MONICNDNCTNT"          
		,KESAUSEYN              "KESAUSEYN"     
		,TESTMASTERYN			"TESTMASTERYN"
		,ADPTRNICKNAME	 		"ADPTRNICKNAME"
		,COMPANYCODEDATA		"COMPANYCODEDATA"
		,BIDINTERFACE		    "BIDINTERFACE"
	  FROM $schemaId$.TSEAIAD01
  </statement>
  
  <!-- 대외기관 정보만 update -->
   <statement id="updateAdptOsidinstiInfo" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
	   	UPDATE  $schemaId$.TSEAIAD01
		SET  ADPTRBZWKGROUPDESC		 =  #ADPTRBZWKGROUPDESC#
			,OSIDINSTIYN             =  #OSIDINSTIYN#
			,OSIDINSTIBZWKRSEMPNAME  =  #OSIDINSTIBZWKRSEMPNAME#
			,OSIDINSTITELNO          =  #OSIDINSTITELNO#
			,MONICNDNCTNT            =  #MONICNDNCTNT#
			,EAISEVRDSTCD            =  #EAISEVRDSTCD#
			,CIRNUMBER  			 =  #CIRNUMBER#
			,DRADPTRYN				 =  #DRADPTRYN#
			,ADPTRINSTICODE			 =  #ADPTRINSTICODE#
			<isNotEmpty prepend="," property="MONIUSEYN">
			 MONIUSEYN              = #MONIUSEYN# 
			</isNotEmpty>      
		WHERE ADPTRBZWKGROUPNAME = #ADPTRBZWKGROUPNAME#
   </statement>
  
  
  
  <statement id="selectChannelList" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
		SELECT HE01.EAIBZWKDSTCD AS "EAIBZWKDSTCD" 
		      , CM01.BZWKDSTICNAME AS "BZWKDSTICNAME" 
		      , SUBSTR(HE01.EAISVCNAME,1,3) AS "CHANNEL"
		  FROM $schemaId$.TSEAIHE01 HE01, $schemaId$.TSEAICM01 CM01
		 WHERE HE01.EAIBZWKDSTCD = CM01.EAIBZWKDSTCD
		   AND HE01.EAIBZWKDSTCD = #eaiBzwkDstcd#
		 GROUP BY HE01.EAIBZWKDSTCD
		      , CM01.BZWKDSTICNAME
		      , SUBSTR(HE01.EAISVCNAME,1,3)
		 ORDER BY HE01.EAIBZWKDSTCD , SUBSTR(HE01.EAISVCNAME,1,3)
  </statement>
  
  <statement id="selectSocketAdapterGroup" parameterClass="java.util.HashMap" resultClass="java.util.LinkedHashMap">
  		SELECT ADPTRBZWKGROUPNAME AS "ADPTRBZWKGROUPNAME",
  			ADPTRBZWKGROUPDESC AS "ADPTRBZWKGROUPDESC"
  		FROM   $schemaId$.TSEAIAD01
  		WHERE  ADPTRCD IN ($adptrCdIn$)
  		order by ADPTRBZWKGROUPNAME
   </statement>
  
   <statement id="updateChangeAdapter" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
   	UPDATE  $schemaId$.TSEAIAD01
   		SET ADPTRUSEYN = #ADPTRUSEYN#
   	WHERE ADPTRBZWKGROUPNAME = #ADPTRBZWKGROUPNAME#
   </statement>
   
    <statement id="selectIsgAdapterPortList" resultClass="java.util.HashMap">
		SELECT ADPTRBZWKGROUPNAME AS "ADPTRBZWKGROUPNAME"
			  ,LNKGPORTINFONAME AS "PORT"
		FROM $schemaId$.TSEAIBJ05 
		WHERE LNKGPORTINFONAME > 40000 
		AND LNKGPORTINFONAME != '' AND ADPTRBZWKGROUPNAME != ''
		ORDER BY LNKGPORTINFONAME
	</statement>

    <statement id="selectChgCmdAdapterList" resultClass="java.util.HashMap">
    	SELECT
			AD01. ADPTRBZWKGROUPNAME AS "ADPTRBZWKGROUPNAME",
			CASE
				WHEN AD01.ADPTRUSEYN IS NULL THEN '0'
				ELSE AD01.ADPTRUSEYN
			END AS "ADPTRUSEYN"
		FROM
			$schemaId$.TSEAIAD01 AD01
		WHERE
			AD01.ADPTRCD IN ('NET', 'SOC')
			AND AD01.TESTMASTERYN != '1'
    </statement>
    
</sqlMap>
