<?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
                    '变更后' AS current_value,
                    (SELECT
                        bp.bp_name
                    FROM
                        con_contract_bp_tenant_lv bp
                    WHERE
                        bp.contract_id = t1.contract_id
                    )bp_name,
                    t1.brand_id_n,
                    t1.series_id_n,
                    t1.model_id_n,
                    TO_CHAR(t1.invoice_price,'999,999,999,900.00') invoice_price,
                    t1.item_frame_number,
                    t1.product_plan_id_n,
                    t1.lease_times,
                    TO_CHAR( t1.down_payment,'999,999,999,900.00') down_payment,
                    trim((TO_CHAR(ROUND(t1.down_payment_ratio,4)*100,'90.00')
                    ||'%'))down_payment_ratio,
                    TO_CHAR( t1.finance_amount,'999,999,999,900.00') finance_amount,
                    t1.license_number,
                    t1.reg_number,
                    lv.dd_bank_account_name,
                    lv.direct_debit_bank_id_n,
                    lv.dd_bank_account_num,
                    lv.ebank_account_prop_n
                FROM
                    con_contract_lease_item_lv t1,
                    con_contract_lv lv
                WHERE
                    lv.contract_id = t1.contract_id AND
                    t1.contract_id = ${@contract_id} #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="current_value"/>
        <bm:field name="brand_id_n"/>
        <bm:field name="series_id_n"/>
        <bm:field name="model_id_n"/>
        <bm:field name="invoice_price"/>
        <bm:field name="item_frame_number"/>
        <bm:field name="product_plan_id_n"/>
        <bm:field name="lease_times"/>
        <bm:field name="down_payment"/>
        <bm:field name="down_payment_ratio"/>
        <bm:field name="finance_amount"/>
        <bm:field name="bp_name"/>
        <bm:field name="license_number"/>
        <bm:field name="reg_number"/>
        <bm:field name="dd_bank_account_name"/>
        <bm:field name="direct_debit_bank_id_n"/>
        <bm:field name="dd_bank_account_num"/>
        <bm:field name="ebank_account_prop_n"/>
    </bm:fields>
</bm:model>
