<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-7-25 下午04:58:52  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:e="leaf.service.exception" xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="CON_CLAUSE_TEMPLET" defaultOrderBy="order_seq">
    <bm:fields>
        <bm:field name="templet_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TEMPLET_ID" prompt="CON_CLAUSE_TEMPLET.TEMPLET_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="${/session/@company_id}" physicalName="COMPANY_ID" prompt="CON_CLAUSE_TEMPLET.COMPANY_ID" updateExpression="${/session/@company_id}"/>
        <bm:field name="templet_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLET_CODE" prompt="CON202.CON_CLAUSE_TEMPLET.TEMPLET_CODE"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="CON202.CON_CLAUSE_TEMPLET.DESCRIPTION"/>
        <bm:field name="templet_usage" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLET_USAGE" prompt="CON_CLAUSE_TEMPLET.TEMPLET_USAGE"/>
        <bm:field name="templet_usage_name" expression="(select s.code_value_name from sys_code_values_v s where s.code = &apos;CON_TMPLET_USAGE&apos; and s.code_value=t1.templet_usage)" forInsert="false" forUpdate="false" prompt="CON_CLAUSE_TEMPLET.TEMPLET_USAGE"/>
        <bm:field name="approval_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="APPROVAL_STATUS" prompt="CON_CLAUSE_TEMPLET.APPROVAL_STATUS"/>
        <bm:field name="approval_status_name" expression="(select s.code_value_name from sys_code_values_v s where s.code = &apos;CON_TERMS_APPROVE_STATUS&apos; and s.code_value=t1.approval_status)" forInsert="false" forUpdate="false" prompt="CON_CLAUSE_TEMPLET.APPROVAL_STATUS"/>
        <bm:field name="language" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LANGUAGE" prompt="CON_CLAUSE_TEMPLET.LANGUAGE"/>
        <bm:field name="language_name" expression="(select s.code_value_name from sys_code_values_v s where s.code = &apos;CON_LANGUAGE&apos; and s.code_value=t1.language)" forInsert="false" forUpdate="false" prompt="CON_CLAUSE_TEMPLET.TEMPLET_USAGE"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="CON_CLAUSE_TEMPLET.ENABLED_FLAG"/>
        <bm:field name="print_num"/>
        <bm:field name="version_date"/>
        <bm:field name="tax_type_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TAX_TYPE_RATE"/>
        <bm:field name="note"/>
        <bm:field name="order_seq"/>
        <bm:field name="doc_plugin_flag"/>
        <bm:field name="doc_template_id"/>
        <bm:field name="doc_template_id_des" expression="(select sc.templet_code from hls_doc_file_templet sc where sc.enabled_flag = &apos;Y&apos; and sc.templet_id=t1.doc_template_id)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="templet_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="templet_code" queryOperator="like"/>
        <bm:query-field field="description" queryOperator="like"/>
        <bm:query-field field="templet_usage" queryOperator="like"/>
        <bm:query-field field="approval_status" queryOperator="like"/>
        <bm:query-field name="enabled_flag" queryExpression="(t1.enabled_flag = ${@enabled_flag} or ${@enabled_flag}=&apos;ALL&apos;)"/>
    </bm:query-fields>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="CON202.TEMPLET_CODE_UNIQ"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
