<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2014-2-21 下午01:35:47  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="PRJ_CDD_TERMS_CHECK_BP" defaultOrderBy="decode(t1.bp_category,&apos;TENANT&apos;,0,&apos;GUARANTOR&apos;,1,&apos;ACTUAL_CONTROLLER&apos;,2,3)">
    <bm:fields>
        <bm:field name="check_bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CHECK_BP_ID" prompt="PRJ_CDD_TERMS_CHECK_BP.CHECK_BP_ID"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID" prompt="PRJ_CDD_TERMS_CHECK_BP.PROJECT_ID"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" prompt="PRJ_CDD_TERMS_CHECK_BP.BP_ID"/>
        <bm:field name="bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY" prompt="PRJ_CDD_TERMS_CHECK_BP.BP_CATEGORY"/>
        <bm:field name="bp_name" expression="(select d.bp_name from hls_bp_master d where d.bp_id=t1.bp_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="bp_category_desc" expression="(select d.description from hls_bp_category d where d.bp_category=t1.bp_category)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
    			begin
    				prj_cdd_terms_check_pkg.delete_terms_check_bp(
			          p_check_bp_id =>${@check_bp_id},
			          p_user_id     =>${/session/@user_id}
		          );
    			end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
        		begin
        			prj_cdd_terms_check_pkg.insert_terms_check_bp(
					  p_check_bp_id     =>${@check_bp_id},
                      p_project_id      =>${@project_id},
                      p_bp_id           =>${@bp_id},
                      p_bp_category     =>${@bp_category},
                      p_user_id         =>${/session/@user_id});
        		end;
        	]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="check_bp_id" dataType="java.lang.Long" input="false" output="true" outputPath="@check_bp_id"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="check_bp_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter name="project_id" enforceOperations="query" expression="t1.project_id=${@project_id}"/>
    </bm:data-filters>
</bm:model>
