<?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="BapAdapterProperty">
	<statement id="selectList" resultClass="java.util.HashMap">
		SELECT ORGTABLE.* 
		  FROM (
			SELECT @NO := @NO + 1 AS ROWNO
				 , A.*
			  FROM (
					SELECT BA03.PRPTYGROUPNAME
						 , BA03.PRPTYGROUPDESC
					  FROM $schemaId$.TSEAIBA03 BA03 
					  LEFT OUTER JOIN $schemaId$.TSEAIBA04 BA04
						ON BA03.PRPTYGROUPNAME = BA04.PRPTYGROUPNAME
				<dynamic prepend="WHERE">
					<isNotEmpty prepend="AND" property="searchPrptyGroupName">
						UPPER(BA03.PrptyGroupName) LIKE CONCAT('%', UPPER(#searchPrptyGroupName#), '%')
					</isNotEmpty>
					<isNotEmpty prepend="AND" property="searchPrptyGroupDesc">
						UPPER(BA03.PrptyGroupDesc) LIKE CONCAT('%', UPPER(#searchPrptyGroupDesc#), '%')
					</isNotEmpty>
					<isNotEmpty prepend="AND" property="searchPrptyName">
						UPPER(BA04.PrptyName) LIKE CONCAT('%', UPPER(#searchPrptyName#), '%')
					</isNotEmpty>
					<isNotEmpty prepend="AND" property="searchPrpty2Val">
						UPPER(BA04.Prpty2Val) LIKE CONCAT('%', UPPER(#searchPrpty2Val#), '%')
					</isNotEmpty>
				</dynamic>
					 GROUP BY BA03.PRPTYGROUPNAME
					 	 , BA03.PRPTYGROUPDESC
					) A
					, (SELECT @NO := 0) R
			 ) ORGTABLE
		 WHERE ROWNO BETWEEN #startNum# AND #endNum#
	</statement>

	<statement id="selectListCount" resultClass="java.lang.Integer">
		SELECT COUNT(*) AS TOTALCOUNT
		  FROM (
				SELECT BA03.PRPTYGROUPNAME
				  FROM $schemaId$.TSEAIBA03 BA03 
				  LEFT OUTER JOIN $schemaId$.TSEAIBA04 BA04
					ON BA03.PRPTYGROUPNAME = BA04.PRPTYGROUPNAME
				<dynamic prepend="WHERE">
					<isNotEmpty prepend="AND" property="searchPrptyGroupName">
						UPPER(BA03.PrptyGroupName) LIKE CONCAT('%', UPPER(#searchPrptyGroupName#), '%')
					</isNotEmpty>
					<isNotEmpty prepend="AND" property="searchPrptyGroupDesc">
						UPPER(BA03.PrptyGroupDesc) LIKE CONCAT('%', UPPER(#searchPrptyGroupDesc#), '%')
					</isNotEmpty>
					<isNotEmpty prepend="AND" property="searchPrptyName">
						UPPER(BA04.PrptyName) LIKE CONCAT('%', UPPER(#searchPrptyName#), '%')
					</isNotEmpty>
					<isNotEmpty prepend="AND" property="searchPrpty2Val">
						UPPER(BA04.Prpty2val) LIKE CONCAT('%', UPPER(#searchPrpty2Val#), '%')
					</isNotEmpty>
				</dynamic>
				 GROUP BY BA03.PRPTYGROUPNAME
				 	 , BA03.PRPTYGROUPDESC
				) ORGTABLE
	</statement>
</sqlMap>
