<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select * from (select cc.contract_id,
       decode(nvl(h.insurance_fee, 0) + nvl(h.insurance_fee_payable, 0),
              0,
              '0.00',
              to_char((nvl(h.insurance_fee, 0) +
                      nvl(h.insurance_fee_payable, 0)),
                      'FM999,999,999,999.00')) insurance_fee,
       change_number_to_rmb(nvl(h.insurance_fee, 0) +
                            nvl(h.insurance_fee_payable, 0)) insurance_fee_rmb,
       decode(h.residual_value,
              0,
              '0.00',
              to_char(h.residual_value, 'FM999,999,999,999.00')) discount_residual_value,
       change_number_to_rmb(h.residual_value) discount_residual_value_rmb,
       decode(h.hd_user_col_n03,
              0,
              '0.00',
              to_char(h.hd_user_col_n03, 'FM999,999,999,999.00')) residual_value,
       change_number_to_rmb(h.hd_user_col_n03) residual_value_rmb
  from con_contract cc, hls_fin_calculator_hd h
 where cc.calc_session_id = h.calc_session_id) #WHERE_CLAUSE#
 ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" required="true"/>
        <bm:field name="insurance_fee" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSURANCE_FEE"/>
        <bm:field name="insurance_fee_rmb" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSURANCE_FEE_RMB"/>
        <bm:field name="residual_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RESIDUAL_VALUE"/>
        <bm:field name="residual_value_rmb" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RESIDUAL_VALUE_RMB"/>
        <bm:field name="discount_residual_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DISCOUNT_RESIDUAL_VALUE"/>
        <bm:field name="discount_residual_value_rmb" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DISCOUNT_RESIDUAL_VALUE_RMB"/>
    </bm:fields>
</bm:model>
