<?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
                    t1.*
                FROM
                    (SELECT
                        bp.bp_id,
                        bp.bp_code,
                        bp.bp_name,
                        bp.bp_category,
                        (SELECT
                            v.code_value_name
                        FROM
                            sys_code_values_v v
                        WHERE
                            v.code              = 'BP_CATEGORY' AND
                            v.code_enabled_flag = 'Y' AND
                            v.code_value        = bp.bp_category
                        ) bp_category_n,
                        bp.bp_type,
                        bp.bp_class
                    FROM
                        hls_bp_master bp
                    WHERE
                        bp.enabled_flag = 'Y'
                         and bp.bp_category = 'AGENT'
                            and NVL(bp.agent_instance_status, 'NEW') IN
                                ('NEW', 'APPROVING', 'REJECT', 'APPROVED', 'APPROVED_RETURN')
                    ) t1 #WHERE_CLAUSE#
            ]]></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" forDisplay="true" forQuery="true" physicalName="BP_CODE" prompt="商业伙伴编码"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="BP_NAME" prompt="商业伙伴名称"/>
        <bm:field name="bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY" prompt="商业伙伴类型"/>
        <bm:field name="bp_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TYPE"/>
        <bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS"/>
        <bm:field name="bp_category_n" forDisplay="true" prompt="商业伙伴类型名称"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="bp_code" queryExpression="t1.bp_code like upper(&apos;%&apos;||${@bp_code}||&apos;%&apos;)"/>
        <bm:query-field field="bp_name" queryOperator="like"/>
    </bm:query-fields>
</bm:model>
