<?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="BapBizGbn">

<!-- 	<statement id="selectListCount" resultClass="java.lang.Integer">
		SELECT 	COUNT(*) AS "TOTALCOUNT"
		FROM $schemaId$.TSEAIBJ02
	    <dynamic prepend="WHERE">
		    <isNotEmpty prepend="AND" property="searchbjobBzwkDstcd">
				BjobBzwkDstcd LIKE #searchbjobBzwkDstcd#
			</isNotEmpty>
		    <isNotEmpty prepend="AND" property="searchbjobBzwkName">
				BjobBzwkName LIKE #searchbjobBzwkName#
			</isNotEmpty> 
		</dynamic> 			
	</statement>	

	<statement id="selectDetail" resultClass="java.util.HashMap">
		SELECT 	
			BJOBBZWKDSTCD  AS "BJOBBZWKDSTCD",  
			BJOBBZWKNAME   AS "BJOBBZWKNAME",  
			BJOBBZWKNAME   AS "OLDBJOBBZWKNAME",  
			THISMSGUSEYN   AS "THISMSGUSEYN",  
			THISMSGREGSNTID AS "THISMSGREGSNTID",  
			THISMSGREGIHMS AS "THISMSGREGIHMS",  
			THISMSGAMNDRID AS "THISMSGAMNDRID",  
			THISMSGAMNDHMS AS "THISMSGAMNDHMS" 
        FROM $schemaId$.TSEAIBJ02
	    WHERE BjobBzwkDstcd = #bjobBzwkDstcd#
	</statement>  
	<statement id="jobpropinfo" resultClass="java.util.HashMap">
		SELECT 	
			BjobBzwkDstcd AS "BJOBBZWKDSTCD",
			PrptyName AS "PRPTYNAME" ,
			PrptyDesc AS "PRPTYDESC" ,
			PrptyTypDstcd AS "PRPTYTYPDSTCD"
        FROM $schemaId$.TSEAIBP06
	    WHERE LTRIM(RTRIM(BjobBzwkDstcd)) = #bjobBzwkDstcd#
	    ORDER BY PrptyTypDstcd
	</statement>  
	
	<statement id="insertPropInfo" resultClass="java.lang.Integer">
		INSERT INTO $schemaId$.TSEAIBP06 (
			BjobBzwkDstcd, 
			PrptyName,
			PrptyDesc,
			PrptyTypDstcd )
		VALUES (
			#bjobBzwkDstcd# ,
			#prptyName#,
			#prptyDesc#,
			#prptyTypDstcd#
		)
	</statement>

	<statement id="delete" resultClass="java.lang.Integer">
		DELETE 	FROM $schemaId$.TSEAIBJ02 
        WHERE BjobBzwkDstcd = #bjobBzwkDstcd#
	</statement>
	
    <statement id="deletePropInfo" resultClass="java.lang.Integer">
        DELETE FROM   $schemaId$.TSEAIBP06
        WHERE BjobBzwkDstcd = #bjobBzwkDstcd#
    </statement>

    <statement id="checkCount" resultClass="java.lang.Integer">
        SELECT COUNT(BjobBzwkDstcd)
        FROM   $schemaId$.TSEAIBJ02
        WHERE BjobBzwkDstcd = #bjobBzwkDstcd#
    </statement>
    
    <statement id="chcekPropInfo" resultClass="java.lang.Integer">
        SELECT COUNT(BjobBzwkDstcd)
        FROM   $schemaId$.TSEAIBP06
        WHERE jobBzwkDstcd = #bjobBzwkDstcd#
    </statement>

 -->

	<statement id="selectList" resultClass="java.util.HashMap">
		SELECT
	       ROWNO, 
	       BjobBzwkDstcd  ,  
	       BjobBzwkName , 
	       ThisMsgUseYn   ,  
	       ThisMsgRegsntID,  
	       ThisMsgRegiHMS ,  
	       ThisMsgAmndrID ,  
	       ThisMsgAmndHMS 
	  	FROM (
		    SELECT
		         ROW_NUMBER() OVER( ORDER BY BjobBzwkDstcd) ROWNO, 
		         BjobBzwkDstcd  ,  
		         BjobBzwkName   , 
            	 ThisMsgUseYn   ,  
            	 ThisMsgRegsntID,  
            	 ThisMsgRegiHMS ,  
            	 ThisMsgAmndrID ,  
            	 ThisMsgAmndHMS 
		      FROM $schemaId$.TSEAIBJ02
		    <dynamic prepend="WHERE">
			    <isNotEmpty prepend="AND" property="searchbjobBzwkDstcd">
					UPPER(BjobBzwkDstcd) LIKE '%' || UPPER(#searchbjobBzwkDstcd#) || '%'
				</isNotEmpty>
			    <isNotEmpty prepend="AND" property="searchbjobBzwkName">
					BjobBzwkName LIKE '%' || #searchbjobBzwkName# || '%'
				</isNotEmpty> 
			</dynamic> 
	       ) TMP
	 	WHERE ROWNO BETWEEN #startNum# AND #endNum#
	</statement>	

	<statement id="update" resultClass="java.lang.Integer">
		UPDATE $schemaId$.TSEAIBJ02 
		SET
			 BjobBzwkName = #bjobBzwkName#,
			 ThisMsgUseYn = #thisMsgUseYn#,
			 ThisMsgAmndrID = #userid#,
			 ThisMsgAmndHMS = TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF3')
		WHERE BjobBzwkDstcd = #bjobBzwkDstcd#
	</statement>
	
	<statement id="insert" resultClass="java.lang.Integer">
		INSERT INTO $schemaId$.TSEAIBJ02 (
			BjobBzwkDstcd, 
			BjobBzwkName,  
			ThisMsgUseYn, 
			ThisMsgRegsntID,  
			ThisMsgRegiHMS ,  
			ThisMsgAmndrID ,  
			ThisMsgAmndHMS )
		VALUES (
			#bjobBzwkDstcd# ,
			#bjobBzwkName# ,
			#thisMsgUseYn# ,
			#userid# ,
			TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF3'),
			#userid# ,
			TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF3') 
		)
	</statement>
	
	
	
	
</sqlMap>