<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Guoxuezhao  
    $Date: 2013-6-3 上午11:12:56  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:ns2="leaf.database.local.oracle" xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="TRE_LOAN_CONTRACT_INT_RATE" needAccessControl="false">
    <bm:fields>
        <bm:field name="loan_contract_int_rate_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LOAN_CONTRACT_INT_RATE_ID" prompt="TRE_LOAN_CONTRACT_INT_RATE.LOAN_CONTRACT_INT_RATE_ID"/>
        <bm:field name="loan_contract_id" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="${../../@loan_contract_id}" physicalName="LOAN_CONTRACT_ID" prompt="TRE_LOAN_CONTRACT_INT_RATE.LOAN_CONTRACT_ID"/>
        <bm:field name="start_date_from" databaseType="DATE" datatype="java.util.Date" physicalName="START_DATE_FROM" prompt="TRE_LOAN_CONTRACT_INT_RATE.START_DATE_FROM"/>
        <bm:field name="start_date_to" databaseType="DATE" datatype="java.util.Date" physicalName="START_DATE_TO" prompt="TRE_LOAN_CONTRACT_INT_RATE.START_DATE_TO"/>
        <bm:field name="int_rate" databaseType="NUMBER" datatype="java.lang.Double" expression="t1.int_rate * 100" physicalName="INT_RATE" prompt="TRE_LOAN_CONTRACT_INT_RATE.INT_RATE"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="TRE_LOAN_CONTRACT_INT_RATE.REF_D05"/>
    </bm:fields>
    <bm:features>
        <ns2:sequence-pk/>
        <f:standard-who/>
    </bm:features>
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
    			begin
    				tre_loan_contract_int_rate_pkg.insert_loan_con_int_rate(p_loan_contract_id=>${../../@loan_contract_id},
															              p_start_date_from=>to_date(${@start_date_from},'yyyy-mm-dd'),
															              p_start_date_to=>to_date(${@start_date_to},'yyyy-mm-dd'),
															              p_int_rate=>${@int_rate}/100,
															              p_user_id=>${/session/@user_id},
															              p_ref_v01=>${@ref_v01},
															              p_ref_v02=>${@ref_v02},
															              p_ref_v03=>${@ref_v03},
															              p_ref_v04=>${@ref_v04},
															              p_ref_v05=>${@ref_v05},
															              p_ref_n01=>${@ref_n01},
															              p_ref_n02=>${@ref_n02},
															              p_ref_n03=>${@ref_n03},
															              p_ref_n04=>${@ref_n04},
															              p_ref_n05=>${@ref_n05},
															              p_ref_d01=>${@ref_d01},
															              p_ref_d02=>${@ref_d02},
															              p_ref_d03=>${@ref_d03},
															              p_ref_d04=>${@ref_d04},
															              p_ref_d05=>${@ref_d05});
              	end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
    			begin
    				tre_loan_contract_int_rate_pkg.update_loan_con_int_rate(p_loan_contract_int_rate_id=>${@loan_contract_int_rate_id},
															              p_loan_contract_id=>${../../@loan_contract_id},
															              p_start_date_from=>to_date(${@start_date_from},'yyyy-mm-dd'),
															              p_start_date_to=>to_date(${@start_date_to},'yyyy-mm-dd'),
															              p_int_rate=>${@int_rate}/100,
															              p_user_id=>${/session/@user_id},
															              p_ref_v01=>${@ref_v01},
															              p_ref_v02=>${@ref_v02},
															              p_ref_v03=>${@ref_v03},
															              p_ref_v04=>${@ref_v04},
															              p_ref_v05=>${@ref_v05},
															              p_ref_n01=>${@ref_n01},
															              p_ref_n02=>${@ref_n02},
															              p_ref_n03=>${@ref_n03},
															              p_ref_n04=>${@ref_n04},
															              p_ref_n05=>${@ref_n05},
															              p_ref_d01=>${@ref_d01},
															              p_ref_d02=>${@ref_d02},
															              p_ref_d03=>${@ref_d03},
															              p_ref_d04=>${@ref_d04},
															              p_ref_d05=>${@ref_d05});
              	end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:primary-key>
        <bm:pk-field name="loan_contract_int_rate_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="loan_contract_id" queryOperator="="/>
    </bm:query-fields>
</bm:model>
