<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                        A.*,
                        ROWNUM RN
                    FROM
                        (SELECT
                            t.bp_id,
                            t.bp_code,
                            t.bp_name,
                            t.bp_type,
                            t.bp_type_n,
                            t.bp_class,
                            t.bp_class_n,
                            t.living_address,
                            t.id_type,
                            t.id_type_n,
                            t.id_card_no,
                            t.address_on_resident_booklit,
                            t.work_unit,
                            t.position,
                            t.position_n,
                            t.work_unit_phone,
                            t.work_unit_address
                        FROM
                            hls_bp_master_lv t #WHERE_CLAUSE#
                        ORDER BY
                            t.bp_id DESC
                        ) A
                    WHERE
                        ROWNUM <= NVL(${@pagesize},10) * NVL(${@offsize},1)
                    )
                WHERE
                    RN >= 1 + ((NVL(${@offsize},1)-1) * NVL(${@pagesize},10))
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID"/>
        <bm:field name="bp_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CODE"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
        <bm:field name="bp_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TYPE"/>
        <bm:field name="bp_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TYPE_N"/>
        <bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS"/>
        <bm:field name="bp_class_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS_N"/>
        <bm:field name="living_address" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LIVING_ADDRESS"/>
        <bm:field name="id_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ID_TYPE"/>
        <bm:field name="id_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ID_TYPE_N"/>
        <bm:field name="id_card_no" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ID_CARD_NO"/>
        <bm:field name="work_unit" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WORK_UNIT"/>
        <bm:field name="position_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POSITION_N"/>
        <bm:field name="address_on_resident_booklit" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ADDRESS_ON_RESIDENT_BOOKLIT"/>
        <bm:field name="position" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POSITION"/>
        <bm:field name="work_unit_phone" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WORK_UNIT_PHONE"/>
        <bm:field name="work_unit_address" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WORK_UNIT_ADDRESS"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="searchInput" queryExpression="t.bp_name like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.bp_class_n like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.bp_type_n like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.bp_type_n like &apos;%&apos;||${@searchInput}||&apos;%&apos;"/>
        <bm:query-field name="bp_id" queryExpression="t.bp_id=${@bp_id}"/>
        <bm:query-field name="bp_name" queryExpression="t.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
