<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" 
	"http://www.ibatis.com/dtd/sql-map-2.dtd">
	
<sqlMap namespace="mmiBapSync">
<!--  
	<statement id="selectCountBJ01" resultClass="java.lang.Integer">
		SELECT 	COUNT(*) AS "TotalCount"
		FROM $schemaId$.TSEAIBJ01 A
        WHERE  TRIM(A.BjobBzwkDstcd) = TRIM(#bjobBzwkDstcd#)
        AND    NVL(A.BjobTranDstcdName,0) = NVL(#bjobTranDstcdName#,0)
	</statement>	
-->
	<statement id="selectCountBJ01" resultClass="java.lang.Integer">
		SELECT 	COUNT(*) AS "TotalCount"
		FROM $schemaId$.TSEAIBJ01 A
        WHERE  TRIM(A.OUTBIZCD) = TRIM(#outBizCd#)
        AND    NVL(A.BjobTranDstcdName,0) = NVL(#fileCode#,0)
	</statement>	
	
	<statement id="selectCountBS01" resultClass="java.lang.Integer">
		SELECT 	COUNT(*) AS "TotalCount"
		FROM $schemaId$.TSEAIBS01 A
        WHERE  TRIM(A.BjobMsgDstcd) = TRIM(#outBizCd#)
        AND    NVL(A.OsidInstiDstcd,0) = NVL(#fileCode#,0)
	</statement>	
	
	<statement id="selectBzwkDstCd" resultClass="java.lang.String">
		SELECT BJOBBZWKDSTCD FROM ( 
			SELECT BJOBBZWKDSTCD FROM IFBPKG.TSEAIBJ05
			WHERE TRIM(OSIDINSTIDSTCD) = TRIM(#outBizCd#)
		) WHERE rownum = 1
	</statement>
	
	<statement id="deleteBJ01" resultClass="java.lang.Integer">
		DELETE FROM $schemaId$.TSEAIBJ01
        WHERE  TRIM(BjobMsgDstcd) = TRIM(#bjobMsgDstcd#)
	</statement>

	<statement id="deleteBS01" resultClass="java.lang.Integer">
		DELETE FROM $schemaId$.TSEAIBS01
        WHERE  TRIM(BjobMsgScheId) = TRIM(#bjobMsgScheId#)
	</statement>
	
	<statement id="insertBapDeploy" resultClass="java.lang.Integer">
		INSERT INTO $schemaId$.TSEAIBJ10 (
		    appCd,
			authorId,
			etcDesc,
			fileCode,
			infDesc,
			infDstCd,
			infId,
			inftName,
			osidInstiCd,
			outBizCd,
			recSize,
			runType,
			snDst,
			srcBzSystemCd,
			srcFileNm,
			srcFilePath,
			tgtFileNm,
			trnsmsnCycle,
			createBy,
			createYmd 
			)
		VALUES (
		    #appCd# 	   ,
		    #authorId# 	   ,
		    #etcDesc# 	   ,
		    #fileCode# 	   ,
            #infDesc# 	   ,
            #infDstCd# 	   ,
            #infId# 	   ,
            #inftName# 	   ,
            #osidInstiCd#  ,
            #outBizCd# 	   ,
            #recSize# 	   ,
            #runType# 	   ,
            #snDst# 	   ,
            #srcBzSystemCd#,
            #srcFileNm#    ,
            #srcFilePath#  ,
            #tgtFileNm#    ,
            #trnsmsnCycle# ,
			#createBy#    ,
            #createYmd# 
			)
	</statement>
	
</sqlMap>