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

<!--   전체 목록수 얻기 -->
	<statement id="selectListCount" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
	  SELECT COUNT(*)  
	   FROM $schemaId$.TSEAIAD01
 	 WHERE ADPTRBZWKGROUPNAME LIKE '%SNA%' 
   	 AND ADPTRIODSTCD = 'I'
   	  <isNotEmpty prepend="AND" property="searchAdptrUseYn">
		ADPTRUSEYN= #searchAdptrUseYn#
	 </isNotEmpty> 	
   	 <isNotEmpty prepend="AND" property="searchAdptrBzwkGroupName">
		UPPER(ADPTRBZWKGROUPNAME) LIKE CONCAT( '%' , UPPER(#searchAdptrBzwkGroupName#) , '%' )
	 </isNotEmpty>
	</statement>

<!--  목록 조회  -->
	<statement id="selectList" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
		SELECT ROWNO
			, ADPTRBZWKGROUPNAME AS "ADPTRBZWKGROUPNAME"
			, ADPTRMSGPTRNCD AS "ADPTRMSGPTRNCD"
			, EAIBZWKDSTCD AS "EAIBZWKDSTCD"
			, ADPTRCD AS "ADPTRCD"
			, ADPTRMSGDSTCD AS "ADPTRMSGDSTCD"
			, ADPTRIODSTCD AS "ADPTRIODSTCD"
			, REFCLSNAME AS "REFCLSNAME"
			, SNDRCVHMSLOGYN AS "SNDRCVHMSLOGYN"
			, ADPTRUSEYN AS "ADPTRUSEYN"
			, SPCFCLUUSEYN AS "SPCFCLUUSEYN"
			, ADPTRBZWKGROUPDESC AS "ADPTRBZWKGROUPDESC"
			, OSIDINSTINO AS "OSIDINSTINO"
		FROM ( 
	          SELECT @NO := @NO + 1 AS ROWNO,
	      			ADPTRBZWKGROUPNAME, ADPTRMSGPTRNCD, EAIBZWKDSTCD, ADPTRCD, 
	    			ADPTRMSGDSTCD, ADPTRIODSTCD, REFCLSNAME, SNDRCVHMSLOGYN, 
	     			ADPTRUSEYN, SPCFCLUUSEYN, ADPTRBZWKGROUPDESC, OSIDINSTINO 
				FROM  $schemaId$.TSEAIAD01 T ,  (SELECT @NO := 0) R 
				WHERE ADPTRBZWKGROUPNAME LIKE '%SNA%' 
	   	 		AND ADPTRIODSTCD = 'I'
			 <isNotEmpty prepend="AND" property="searchAdptrUseYn">
				ADPTRUSEYN= #searchAdptrUseYn#
			 </isNotEmpty> 	
		   	 <isNotEmpty prepend="AND" property="searchAdptrBzwkGroupName">
				UPPER(ADPTRBZWKGROUPNAME) LIKE CONCAT( '%' , UPPER(#searchAdptrBzwkGroupName#) , '%' )
			 </isNotEmpty>
			) TMP1
			WHERE ROWNO BETWEEN #startNum# AND #endNum#
	</statement>	
		
	
	<statement id="selectListToExcel" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
		SELECT $headersStr$
		FROM ( 
		  SELECT 
	  		ADPTRBZWKGROUPNAME, ADPTRMSGPTRNCD, EAIBZWKDSTCD, ADPTRCD, 
	        ADPTRMSGDSTCD, ADPTRIODSTCD, REFCLSNAME, SNDRCVHMSLOGYN, 
	        ADPTRUSEYN, SPCFCLUUSEYN, ADPTRBZWKGROUPDESC, OSIDINSTINO 
		  FROM $schemaId$.TSEAIAD01
  		 WHERE ADPTRBZWKGROUPNAME LIKE '%SNA%' 
    	 AND ADPTRIODSTCD = 'I'
    	 <isNotEmpty prepend="AND" property="searchAdptrUseYn">
			ADPTRUSEYN= #searchAdptrUseYn#
		 </isNotEmpty> 	
    	 <isNotEmpty prepend="AND" property="searchAdptrBzwkGroupName">
			ADPTRBZWKGROUPNAME = #searchAdptrBzwkGroupName#
		 </isNotEmpty>
		) TMP1
		ORDER BY ADPTRIODSTCD, ADPTRBZWKGROUPNAME
	</statement>	

</sqlMap>