<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-3-1 下午1:39:08  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="GLD_JE_TEMPLATE_ACC_CONFIG">
    <bm:fields>
        <bm:field name="je_template_ln_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="JE_TEMPLATE_LN_ID"/>
        <bm:field name="mapping_condition_code" forInsert="false" forUpdate="false" prompt="GLD107.GLD_JE_TEMPLATE_ACC_CONFIG.MAPPING_CONDITION_CODE"/>
        <bm:field name="condition_config" forInsert="false" forUpdate="false" prompt="GLD107.GLD_JE_TEMPLATE_ACC_CONFIG.CONDITION_TABLE"/>
        <bm:field name="condition_config_id" forInsert="false" forUpdate="false" prompt="GLD107.GLD_JE_TEMPLATE_ACC_CONFIG.CONDITION_COLUMN"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    		    select a.je_template_ln_id,
				       b.mapping_condition_code,
				       a.condition_config,
				       a.condition_config_id
				  from gld_je_template_acc_config a,
				       gld_usage_codes_catalog    b
				 where a.je_template_ln_id(+) = ${@je_template_ln_id}
				   and b.usage_code = upper(${@usage_code})
				   and a.usage_code(+) = b.usage_code
				   and a.mapping_condition_code(+) = b.mapping_condition_code
				order by b.mapping_condition_code
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
    			begin
		   		     GLD104_SAVE_PKG.acc_para_update(p_je_template_ln_id    => ${@je_template_ln_id},
							                         p_usage_code           => ${@usage_code},
							                         p_mapping_condition_code => ${@mapping_condition_code},
							                         p_condition_config      => ${@config_desc},
							                         p_condition_config_id  => ${@config_id},
							                         p_user_id              => ${/session/@user_id});
				end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    			begin
				   GLD104_SAVE_PKG.acc_config_insert(p_je_template_ln_id    => ${@je_template_ln_id},
							                         p_usage_code           => ${@usage_code},
							                         p_config_desc			=> ${@config_desc},
							                         p_user_id              => ${/session/@user_id});
				end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
    </bm:features>
</bm:model>
