<?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 *
		FROM (
                SELECT  ROW_NUMBER() OVER(ORDER BY BA03.PrptyGroupName) ROWNO, 
						BA03.PrptyGroupName, BA03.PrptyGroupDesc
						FROM $schemaId$.TSEAIBP01 BA03 LEFT OUTER JOIN $schemaId$.TSEAIBP02 BA04
					ON BA03.PRPTYGROUPNAME = BA04.PRPTYGROUPNAME
			<dynamic prepend="WHERE">
				<isNotEmpty prepend="AND" property="searchPrptyGroupName">
					UPPER(BA03.PrptyGroupName) LIKE UPPER('%' || #searchPrptyGroupName# || '%')
				</isNotEmpty>
				<isNotEmpty prepend="AND" property="searchPrptyGroupDesc">
					UPPER(BA03.PrptyGroupDesc) LIKE UPPER('%' || #searchPrptyGroupDesc# || '%')
				</isNotEmpty>
				<isNotEmpty prepend="AND" property="searchPrptyName">
					UPPER(BA04.PRPTYNAME) LIKE UPPER('%' || #searchPrptyName# || '%')
				</isNotEmpty>
				<isNotEmpty prepend="AND" property="searchPrpty2Val">
					UPPER(BA04.PRPTY2VAL) LIKE UPPER('%' || #searchPrpty2Val# || '%')
				</isNotEmpty>
			</dynamic>		
				GROUP BY BA03.PRPTYGROUPNAME, BA03.PRPTYGROUPDESC						
			) 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$.TSEAIBP01 BA03 LEFT OUTER JOIN $schemaId$.TSEAIBP02 BA04
					ON BA03.PRPTYGROUPNAME = BA04.PRPTYGROUPNAME
		<dynamic prepend="WHERE">
			<isNotEmpty prepend="AND" property="searchPrptyGroupName">
				UPPER(BA03.PrptyGroupName) LIKE UPPER('%' || #searchPrptyGroupName# || '%')
			</isNotEmpty>
			<isNotEmpty prepend="AND" property="searchPrptyGroupDesc">
				UPPER(BA03.PrptyGroupDesc) LIKE UPPER('%' || #searchPrptyGroupDesc# || '%')
			</isNotEmpty>
			<isNotEmpty prepend="AND" property="searchPrptyName">
				UPPER(BA04.PRPTYNAME) LIKE UPPER('%' || #searchPrptyName# || '%')
			</isNotEmpty>
			<isNotEmpty prepend="AND" property="searchPrpty2Val">
				UPPER(BA04.PRPTY2VAL) LIKE UPPER('%' || #searchPrpty2Val# || '%')
			</isNotEmpty>
		</dynamic>				
				GROUP BY BA03.PRPTYGROUPNAME, BA03.PRPTYGROUPDESC		)
	</statement>	
</sqlMap>
