<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-11-7 下午6:33:09  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="GLD_JE_TEMPLATE_GRP_ASSIGN">
    <bm:fields>
        <bm:field name="template_group_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TEMPLATE_GROUP_ID" prompt="GLD_JE_TEMPLATE_GRP_ASSIGN.TEMPLATE_GROUP_ID"/>
        <bm:field name="je_template_hd_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="JE_TEMPLATE_HD_ID" prompt="GLD_JE_TEMPLATE_GRP_ASSIGN.JE_TEMPLATE_HD_ID"/>
        <bm:field name="je_template_code" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" physicalName="JE_TEMPLATE_CODE" prompt="GLD107.GLD_JE_TEMPLATE_HDS.JE_TEMPLATE_CODE"/>
        <bm:field name="je_template_desc" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" physicalName="JE_TEMPLATE_DESC" prompt="GLD107.GLD_JE_TEMPLATE_HDS.JE_TEMPLATE_DESC"/>
        <bm:field name="order_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ORDER_SEQ" prompt="凭证生成顺序"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.template_group_id,
				       t1.je_template_hd_id,
				       h.je_template_desc,
				       h.je_template_code,
				       t1.order_seq,
				       t1.enabled_flag
				  from gld_je_template_grp_assign t1
				 inner join gld_je_template_hds h
				    on h.je_template_hd_id = t1.je_template_hd_id
				 #WHERE_CLAUSE#
				 order by t1.order_seq,h.je_template_code
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.template_group_id = ${@template_group_id}"/>
    </bm:data-filters>
    <bm:primary-key>
        <bm:pk-field name="template_group_id"/>
        <bm:pk-field name="je_template_hd_id"/>
    </bm:primary-key>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="凭证模板重复：${@je_template_code}"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
