<?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="IoMapLoader">
	
	<statement id="checkInterface" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
	 	select count(1) FROM $schemaId$.TSEAIHE01 
	 	WHERE 	EaiSvcName = #eaiSvcName#
	</statement>
	
	<statement id="selectTransformListForLayout" parameterClass="java.util.HashMap" resultClass="java.lang.String">
	 	select cnvsnName FROM $schemaId$.TSEAITR02 
	 	WHERE 	LoutName = #loutName#
	</statement>


	<statement id="deleteTSEAIIL02" parameterClass="java.util.HashMap" >
	 	DELETE from $schemaId$.TSEAIIL02 
	 	 WHERE BascRspnsChngMsgIDName = #pkgNumber#
	</statement>

	<statement id="insertTSEAIIL02UPPER" parameterClass="java.util.HashMap" >
	 	INSERT INTO $schemaId$.TSEAIIL02 
	 	        (EAISVCNAME , CHNGMSGIDNAME , BASCRSPNSCHNGMSGIDNAME , ERRRSPNSCHNGMSGIDNAME , APLYCHNGMSGFLDNAME , PSVINTFACDSTICNAME)
	 	 VALUES (#EAISVCNAME# , #CHNGMSGIDNAME# , #BASCRSPNSCHNGMSGIDNAME# , #ERRRSPNSCHNGMSGIDNAME# , #APLYCHNGMSGFLDNAME# , #PSVINTFACDSTICNAME#)
	</statement>
	
	<!-- 변환 추출시 필요할꺼 같음 -->
	<statement id="selectInterfaceListForTransform" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
	 	SELECT EAISVCNAME , '$cnvsnName$' CHNGMSGIDNAME ,'$cnvsnNameType$' APLYCHNGMSGFLDNAME , PSVINTFACDSTICNAME 
	 	  FROM $schemaId$.TSEAIHE02 h2, TSEAIHE01 h1
	 	 WHERE $cnvsnNameType$ = #cnvsnName#
	 	   AND $cnvsnNameYn$ = '1'
	 	   AND h1.EAISVCNAME = h2.EAISVCNAME
	 	   AND h1.USEYN ='1'
	</statement>
	<statement id="selectInterfaceListForTransform2" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
	 	select EAISVCNAME , PSVINTFACDSTICNAME FROM $schemaId$.TSEAIHE02 
	 	WHERE  ( CHNGMSGIDNAME = #cnvsnName# OR BASCRSPNSCHNGMSGIDNAME = #cnvsnName# OR ERRRSPNSCHNGMSGIDNAME = #cnvsnName# )
	</statement>
	
	<statement id="selectInterfaceListNonExist" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
	 	SELECT DISTINCT EAISvcName FROM $schemaId$.TSEAIIL02 WHERE BascRspnsChngMsgIDName = #pkgNumber#
		MINUS
		SELECT EAISvcName FROM $schemaId$.TSEAIHE01 
		 WHERE EAISvcName IN (SELECT EAISvcName FROM $schemaId$.TSEAIIL02 WHERE BascRspnsChngMsgIDName = #pkgNumber#)
		   AND USEYN='1' 
	 	
	</statement>
	
	<statement id="selectTSEAIIL02" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
	 	select * FROM $schemaId$.TSEAIIL02
	 	 WHERE BascRspnsChngMsgIDName = #pkgNumber#
	 	   AND ErrRspnsChngMsgIDName = #applyYn#  
	</statement>
	<statement id="updateTSEAIHE02" parameterClass="java.util.HashMap" >
	 	UPDATE $schemaId$.TSEAIHE02 
	 	   SET $APLYCHNGMSGFLDNAME$ = #CHNGMSGIDNAME#
	 	     , $TRANTYPEYNNAME$ = #TRANTYPEYNVALUE#
	 	 WHERE EAISvcName = #EAISVCNAME# 
	 	   and SvcPrcssNo = '1'
	</statement>
	<statement id="deleteAllTSEAIDC01" parameterClass="java.util.HashMap" >
	 	DELETE from $schemaId$.TSEAIDC01
	</statement>
	
	<statement id="insertTSEAIDC01" parameterClass="java.util.HashMap" >
	 	INSERT INTO $schemaId$.TSEAIDC01 
	 	        (EAISVCNAME , SplizValdYmd )
	 	 VALUES (#eaiSvcName# , #splizValdYmd# )
	</statement>
	<statement id="selectInterfaceInfo" parameterClass="java.util.HashMap" resultClass="java.util.LinkedHashMap">
		<![CDATA[
	  	SELECT EAISvcName, ChngMsgIDName , AplyChngMsgFldName ,PsvIntfacDsticName FROM (
			SELECT EAISvcName, ChngMsgIDName as ChngMsgIDName , 'ChngMsgIDName' as AplyChngMsgFldName ,PsvIntfacDsticName  from $schemaId$.tseaihe02 where ChngEonot = 1 and ChngMsgIDName <>''
			UNION 
			SELECT EAISvcName, BascRspnsChngMsgIDName as ChngMsgIDName , 'BascRspnsChngMsgIDName' as AplyChngMsgFldName,PsvIntfacDsticName from $schemaId$.tseaihe02 where BascRspnsChngEonot = 1 and BascRspnsChngMsgIDName <>''
			UNION 
			SELECT EAISvcName, ErrRspnsChngMsgIDName as ChngMsgIDName , 'ErrRspnsChngMsgIDName' as AplyChngMsgFldName,PsvIntfacDsticName  from $schemaId$.tseaihe02 where ErrRspnsChngEonot = 1 and ErrRspnsChngMsgIDName <> ''
		) WHERE ChngMsgIDName =#cnvsnName# and EAISvcName in (select EAISvcName from $schemaId$.tseaihe01 where EAISevrDstcd=#eaiSevrDstcd# )
		]]>
	</statement>
	<statement id="selectInterfaceInfoForCommonError" parameterClass="java.util.HashMap" resultClass="java.util.LinkedHashMap">
		<![CDATA[
		SELECT EAISvcName, ErrRspnsChngMsgIDName as ChngMsgIDName , 'ErrRspnsChngMsgIDName' as AplyChngMsgFldName,PsvIntfacDsticName  
		  FROM $schemaId$.tseaihe02 WHERE ErrRspnsChngEonot = 1 AND ErrRspnsChngMsgIDName <> ''
		   AND EAISvcName = #eaiSvcName# AND ErrRspnsChngMsgIDName like 'TRANSFORM_EAI%'
		]]>	   
	</statement>	

</sqlMap>
