<?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="BapTeleProperty">
	<statement id="selectList" resultClass="java.util.HashMap">
		SELECT *
		FROM (
                SELECT  ROW_NUMBER() OVER(ORDER BY BA05.PrptyGroupName) ROWNO, 
						BA05.PrptyGroupName, BA05.PrptyGroupDesc
						FROM $schemaId$.TSEAIBP01 BA05 LEFT OUTER JOIN $schemaId$.TSEAIBP02 BA06
					ON BA05.PRPTYGROUPNAME = BA06.PRPTYGROUPNAME
			<dynamic prepend="WHERE">
				<isNotEmpty prepend="AND" property="searchPrptyGroupName">
					UPPER(BA05.PrptyGroupName) LIKE UPPER('%' || #searchPrptyGroupName# || '%')
				</isNotEmpty>
				<isNotEmpty prepend="AND" property="searchPrptyGroupDesc">
					UPPER(BA05.PrptyGroupDesc) LIKE UPPER('%' || #searchPrptyGroupDesc# || '%')
				</isNotEmpty>
				<isNotEmpty prepend="AND" property="searchPrptyName">
					UPPER(BA06.PRPTYNAME) LIKE UPPER('%' || #searchPrptyName# || '%')
				</isNotEmpty>
				<isNotEmpty prepend="AND" property="searchPrpty2Val">
					UPPER(BA06.PRPTY2VAL) LIKE UPPER('%' || #searchPrpty2Val# || '%')
				</isNotEmpty>
			</dynamic>			
				GROUP BY BA05.PRPTYGROUPNAME, BA05.PRPTYGROUPDESC				
			) ORGTABLE
		WHERE ROWNO BETWEEN #startNum# AND #endNum#
	</statement>	

	<statement id="selectListCount" resultClass="java.lang.Integer">
		SELECT 	COUNT(*) AS TOTALCOUNT
		FROM (  SELECT BA05.PRPTYGROUPNAME
			FROM $schemaId$.TSEAIBP01 BA05 LEFT OUTER JOIN $schemaId$.TSEAIBP02 BA06
					ON BA05.PRPTYGROUPNAME = BA06.PRPTYGROUPNAME
		<dynamic prepend="WHERE">
			<isNotEmpty prepend="AND" property="searchPrptyGroupName">
				UPPER(BA05.PrptyGroupName) LIKE UPPER('%' || #searchPrptyGroupName# || '%')
			</isNotEmpty>
			<isNotEmpty prepend="AND" property="searchPrptyGroupDesc">
				UPPER(BA05.PrptyGroupDesc) LIKE UPPER('%' || #searchPrptyGroupDesc# || '%')
			</isNotEmpty>
			<isNotEmpty prepend="AND" property="searchPrptyName">
				UPPER(BA06.PRPTYNAME) LIKE UPPER('%' || #searchPrptyName# || '%')
			</isNotEmpty>
			<isNotEmpty prepend="AND" property="searchPrpty2Val">
				UPPER(BA06.PRPTY2VAL) LIKE UPPER('%' || #searchPrpty2Val# || '%')
			</isNotEmpty>
		</dynamic>				
				GROUP BY BA05.PRPTYGROUPNAME, BA05.PRPTYGROUPDESC		)	
	</statement>
</sqlMap>
