<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-8-21 上午10:45:42  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" 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_ITEM_TEMPLET_HD" defaultOrderBy="templet_code">
    <bm:fields>
        <bm:field name="templet_head_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TEMPLET_HEAD_ID" prompt="PRJ_CDD_ITEM_TEMPLET_HD.TEMPLET_HEAD_ID"/>
        <bm:field name="templet_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLET_CODE" prompt="PRJ_CDD_ITEM_TEMPLET_HD.TEMPLET_CODE"/>
        <bm:field name="templet_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLET_NAME" prompt="PRJ_CDD_ITEM_TEMPLET_HD.TEMPLET_NAME"/>
        <bm:field name="note" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTE" prompt="PRJ_CDD_ITEM_TEMPLET_HD.NOTE"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="PRJ_CDD_ITEM_TEMPLET_HD.ENABLED_FLAG"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="templet_head_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="templet_code" queryOperator="like"/>
        <bm:query-field field="templet_name" queryOperator="like"/>
        <bm:query-field name="enabled_flag" queryExpression="(t1.enabled_flag = ${@enabled_flag} or ${@enabled_flag}=&apos;ALL&apos;)"/>
    </bm:query-fields>
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    			begin
    			  prj_cdd_item_pkg.prj_cdd_item_templet_copy(p_templet_head_id  => ${@templet_head_id},
                                             p_new_templet_code =>${@new_templet_code},
                                             p_new_templet_name =>${@new_templet_name},
                                             p_user_id          =>${/session/@user_id});
    			end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="HLS220.TEMPLET_CODE_UNIQ"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
