<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-2.dtd">

<sqlMap namespace="ClassMap">

    <statement id="list" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
        SELECT TELGMCLSID,
               TELGMCLSNAME,
               MSGMETADSTCD,
               ROWNO
        FROM(
            SELECT TELGMCLSID,
               TELGMCLSNAME,
               MSGMETADSTCD,
                   @NO := @NO + 1 AS ROWNO
            FROM $schemaId$.TSEAIBR05,  (SELECT @NO := 0) R
            <dynamic prepend="WHERE">
                <isNotEmpty prepend="AND" property="searchTelgmClsID">
                    TelgmClsID LIKE CONCAT('%' , #searchTelgmClsID# , '%')
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchMsgMetaDstcd">
                    MsgMetaDstcd LIKE CONCAT( '%' , #searchMsgMetaDstcd# , '%')
                </isNotEmpty>
            </dynamic>
            ORDER BY TelgmClsID
            ) TMP
        WHERE ROWNO BETWEEN #startNum# AND #endNum#

    </statement>

    <statement id="count" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
        SELECT COUNT(TelgmClsID) AS "TotalCount"
        FROM   $schemaId$.TSEAIBR05
        <dynamic prepend="WHERE">
            <isNotEmpty prepend="AND" property="searchTelgmClsID">
                TelgmClsID LIKE CONCAT('%' , #searchTelgmClsID# , '%')
            </isNotEmpty>
            <isNotEmpty prepend="AND" property="searchMsgMetaDstcd">
               MsgMetaDstcd LIKE CONCAT( '%' , #searchMsgMetaDstcd# , '%')
            </isNotEmpty>
        </dynamic>
    </statement>

</sqlMap>