<?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="BapSysinfo">
	<statement id="selectList" resultClass="java.util.HashMap">
		SELECT *
		FROM (
                SELECT  ROW_NUMBER() OVER(ORDER BY SysCd) ROWNO, 
						SysCd        ,
						SysName      ,
                        SysIp        ,
                        SysPort      ,
                        UserId       ,
                        UserPassword ,
                        SendDir      ,
                        RecvDir      ,
                        SftpYn       ,
                        ThisMsgUseYn       
						FROM $schemaId$.TSEAIBJ11
			<dynamic prepend="WHERE">
				<isNotEmpty prepend="AND" property="searchSysCd">
					UPPER(SysCd) LIKE UPPER('%' || #searchSysCd# || '%')
				</isNotEmpty>
				<isNotEmpty prepend="AND" property="searchSysName">
					UPPER(SysName) LIKE UPPER('%' || #searchSysName# || '%')
				</isNotEmpty>
			</dynamic>						
			) ORGTABLE
		WHERE ROWNO BETWEEN #startNum# AND #endNum#
	</statement>	

	<statement id="selectListCount" resultClass="java.lang.Integer">
		SELECT 	COUNT(*) AS TOTALCOUNT
			FROM $schemaId$.TSEAIBJ11
		<dynamic prepend="WHERE">
			<isNotEmpty prepend="AND" property="searchSysCd">
				UPPER(SysCd) LIKE UPPER('%' || #searchSysCd# || '%')
			</isNotEmpty>
			<isNotEmpty prepend="AND" property="searchSysName">
				UPPER(SysName) LIKE UPPER('%' || #searchSysName# || '%')
			</isNotEmpty>
		</dynamic>				
	</statement>	

	<statement id="update" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		UPDATE 	$schemaId$.TSEAIBJ11 SET
				SysName        = #sysName#,
                SysIp          = #sysIp#,
                SysPort        = #sysPort#,
                UserId         = NVL(#userId#,' '),
                UserPassword   = #userPassword#,
                SendDir        = NVL(#sendDir#, ' '),
                RecvDir        = NVL(#recvDir#, ' '),
                SftpYn         = #sftpYn#,       
				ThisMsgUseYn   = #thisMsgUseYn#,
				ThisMsgAmndrID = #userid# ,
				ThisMsgAmndHMS = TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF3') 
		WHERE 	SysCd        = #sysCd#
	</statement>
	
	<statement id="insert" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
		INSERT 	INTO $schemaId$.TSEAIBJ11(
				     SysCd          ,
				     SysName        ,
				     SysIp          ,
				     SysPort        ,
				     UserId         ,
				     UserPassword   ,
				     SendDir        ,
				     RecvDir        ,
				     SftpYn         ,
				     ThisMsgUseYn   ,
				     ThisMsgRegsntID,
				     ThisMsgRegiHMS ,
				     ThisMsgAmndrID ,
				     ThisMsgAmndHMS 
				)
				VALUES(
				     #sysCd#       ,
				     #sysName#     ,      
				     #sysIp#       ,        
				     #sysPort#     ,      
				     NVL(#userId#,' ')      ,       
				     #userPassword#, 
				     NVL(#sendDir#, ' ')     ,      
				     NVL(#recvDir# , ' ')    ,      
				     #sftpYn#      ,  
				     #thisMsgUseYn#,
				     #userid#,
				     TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF3'),
				     #userid#,
				     TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF3')
				)
	</statement>
	
</sqlMap>
