<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2014-2-24 下午04:05:45  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    d.contract_id,
                    d.bp_category,
                    (SELECT
                        c.description
                    FROM
                        hls_bp_category c
                    WHERE
                        c.bp_category = d.bp_category
                    ) bp_category_desc,
                    d.record_id,
                    h.bp_id,
                    h.bp_code,
                    h.bp_name
                FROM
                    con_contract_bp d,
                    con_contract cc,
                    hls_bp_master_all_data_v h #WHERE_CLAUSE#
                ORDER BY
                    h.bp_code
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID"/>
        <bm:field name="bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY"/>
        <bm:field name="bp_category_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY_DESC"/>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID"/>
        <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" displayWidth="210" forDisplay="true" forQuery="true" physicalName="BP_CODE" prompt="HLS.BP_CODE"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="210" forDisplay="true" forQuery="true" physicalName="BP_NAME" prompt="HLS.BP_NAME"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="bp_code" queryOperator="like"/>
        <bm:query-field field="bp_name" queryOperator="like"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="d.contract_id = cc.contract_id AND cc.project_id = ${@project_id} AND d.bp_id= h.bp_id and d.bp_category=${@bp_category}"/>
    </bm:data-filters>
</bm:model>
