<?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="SocketPort">
	<statement id="selectPortList" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
	 	SELECT     
		      EAISEVRDSTCD
		    , RECVADPTRBZWKNAME
		    , RECVADPTRDESC
		    , RECVTESTPORT
		    , RECVREALPORT
		    , RECVPORTLASTYMD
		    , RECVLASTADMUSERID
		    , SENDADPTRBZWKNAME
		    , SENDADPTRDESC
		    , SENDTESTPORT
			, SENDREALPORT
		    , SENDPORTLASTYMD
		    , SENDLASTADMUSERID
		FROM  $schemaId$.TSEAIRM31 WHERE EAISEVRDSTCD  = #eaiSevrDstCd#
	</statement>
	<statement id="selectPortdupChk" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		SELECT COUNT(*) AS CNT
			FROM $schemaId$.TSEAIRM31
		WHERE RECVTESTPORT = #recvTestPort#
	</statement>

	<statement id="selectDetail" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
		SELECT 
			  EAISEVRDSTCD AS "EAISEVRDSTCD"
			, RECVADPTRBZWKNAME AS "RECVADPTRBZWKNAME"
		    , RECVADPTRDESC AS "RECVADPTRDESC"
		    , RECVTESTPORT AS "RECVTESTPORT"
		    , RECVREALPORT AS "RECVREALPORT"
		    , RECVPORTLASTYMD AS "RECVPORTLASTYMD"
		    , RECVLASTADMUSERID AS "RECVLASTADMUSERID"
		    , SENDADPTRBZWKNAME AS "SENDADPTRBZWKNAME"
		    , SENDADPTRDESC AS "SENDADPTRDESC"
		    , SENDTESTPORT AS "SENDTESTPORT"
			, SENDREALPORT AS "SENDREALPORT"
		    , SENDPORTLASTYMD AS "SENDPORTLASTYMD"
		    , SENDLASTADMUSERID AS "SENDLASTADMUSERID"
		  FROM  $schemaId$.TSEAIRM31
		  WHERE EAISEVRDSTCD = #eaiSevrDstCd#
		  AND RECVTESTPORT = #recvTestPort#
	</statement>
	
	<statement id="insert" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		INSERT INTO  $schemaId$.TSEAIRM31
		    ( EAISEVRDSTCD
		    , RECVADPTRBZWKNAME
		    , RECVADPTRDESC
		    , RECVTESTPORT
		    , RECVREALPORT
		    , RECVPORTLASTYMD
		    , RECVLASTADMUSERID
		    , SENDADPTRBZWKNAME
		    , SENDADPTRDESC
		    , SENDTESTPORT
			, SENDREALPORT
		    , SENDPORTLASTYMD
		    , SENDLASTADMUSERID
		    )
		VALUES
			( #eaiSevrDstCd#
			, #recvAdptrBzwkName#
		    , #recvAdptrDesc#
		    , #recvTestPort#
			, #recvRealPort#
		    , #recvPortLastYmd#
		    , #recvLastAdmUserId#
			, #sendAdptrBzwkName#
		    , #sendAdptrDesc#
		    , #sendTestPort# 
		    , #sendRealPort#
		    , #sendPortLastYmd#
		    , #sendLastAdmUserId#
		    )
	</statement>
	
	<statement id="update" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		UPDATE $schemaId$.TSEAIRM31
			SET   RECVADPTRBZWKNAME   = #recvAdptrBzwkName#               
			    , RECVADPTRDESC       =	#recvAdptrDesc# 
			    <isEqual property="resvModYN" compareValue="Y">        
			    , RECVPORTLASTYMD     =	#recvPortLastYmd#         
			    , RECVLASTADMUSERID   =	#recvLastAdmUserId# 
     			</isEqual>
			    , SENDADPTRBZWKNAME   =	#sendAdptrBzwkName#       
			    , SENDADPTRDESC       = #sendAdptrDesc#           
			    , SENDTESTPORT        =	#sendTestPort#
				, SENDREALPORT        = #sendRealPort#  
				<isEqual property="sendModYN" compareValue="Y">  
			    , SENDPORTLASTYMD     = #sendPortLastYmd#         
			    , SENDLASTADMUSERID   =	#sendLastAdmUserId#  
			    </isEqual>
			WHERE EAISEVRDSTCD = #eaiSevrDstCd#
			AND RECVTESTPORT  = #recvTestPort# 
	</statement>
	
	<statement id="delete" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		DELETE FROM $schemaId$.TSEAIRM31
			WHERE EAISEVRDSTCD = #eaiSevrDstCd#
		AND RECVTESTPORT  = #recvTestPort# 
	</statement>
	
</sqlMap>
