<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2014-2-21 下午02:40:50  
    $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" defaultOrderBy="t1.order_seq">
    <bm:fields>
        <bm:field name="check_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CHECK_ID" prompt="PRJ_CDD_TERMS_CHECK.CHECK_ID"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID" prompt="PRJ_CDD_TERMS_CHECK.PROJECT_ID"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" prompt="PRJ_CDD_TERMS_CHECK.BP_ID"/>
        <bm:field name="bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY" prompt="PRJ_CDD_TERMS_CHECK.BP_CATEGORY"/>
        <bm:field name="order_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ORDER_SEQ" prompt="PRJ_CDD_TERMS_CHECK.ORDER_SEQ"/>
        <bm:field name="cdd_item" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CDD_ITEM" prompt="PRJ_CDD_TERMS_CHECK.CDD_ITEM"/>
        <bm:field name="cdd_title" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CDD_TITLE" prompt="PRJ_CDD_TERMS_CHECK.CDD_TITLE"/>
        <bm:field name="submited_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SUBMITED_FLAG" prompt="PRJ_CDD_TERMS_CHECK.SUBMITED_FLAG"/>
        <bm:field name="confirmed_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONFIRMED_FLAG" prompt="PRJ_CDD_TERMS_CHECK.CONFIRMED_FLAG"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="PRJ_CDD_TERMS_CHECK.DESCRIPTION"/>
        <bm:field name="note" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTE" prompt="PRJ_CDD_TERMS_CHECK.NOTE"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
        		BEGIN
        		    prj_cdd_terms_check_pkg.insert_terms_check(
        		    p_check_id=>${@check_id}, 
        		    p_project_id=>${@project_id}, 
        		    p_bp_id=>${@bp_id}, 
        		    p_bp_category=>${@bp_category}, 
        		    p_order_seq=>${@order_seq}, 
        		    p_cdd_item=>${@cdd_item}, 
        		    p_cdd_title=>${@cdd_title}, 
        		    p_submited_flag=>${@submited_flag}, 
        		    p_confirmed_flag=>${@confirmed_flag}, 
        		    p_description=>${@description}, 
        		    p_note=>${@note}, 
        		    p_user_id=>${/session/@user_id});
        		END;
	 		]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="check_id" dataType="java.lang.Long" input="false" output="true" outputPath="@check_id"/>
            </bm:parameters>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
    			begin
	    			prj_cdd_terms_check_pkg.delete_terms_check(
	    					   p_check_id =>${@check_id}, 
	    			           p_user_id =>${/session/@user_id});
    			end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="check_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter name="project_id" enforceOperations="query" expression="t1.project_id=${@project_id}"/>
        <bm:data-filter name="bp_id" enforceOperations="query" expression="t1.bp_id=${@bp_id}"/>
        <bm:data-filter name="bp_category" enforceOperations="query" expression="t1.bp_category=${@bp_category}"/>
    </bm:data-filters>
</bm:model>
