<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-9-27 下午01:13:41  
    $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 * from (
            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,
			       h.bp_type,
			       h.bp_type_desc,   
       			   h.bp_class,
                   h.bp_class_desc
			  from con_contract_bp d, hls_bp_master_all_data_v h
			  where 
			  	    d.contract_id=${@contract_id}
			  		and d.bp_id = h.bp_id
			  )t1
			  #WHERE_CLAUSE#
			  order by t1.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:field name="bp_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TYPE"/>
        <bm:field name="bp_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TYPE_DESC"/>
        <bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS"/>
        <bm:field name="bp_class_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CLASS_DESC"/>
    </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=${@contract_id} and d.bp_id = h.bp_id"/>
    </bm:data-filters> -->
</bm:model>
