<?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
                    t.product_plan_id,
                    (SELECT
                        sv.code_value_name
                    FROM
                        sys_code_values_v sv
                    WHERE
                        sv.code       = 'PRODUCT_CATEGORY' AND
                        sv.code_value = t.product_type
                    ) product_type_n,
                    t.product_name,
                    t.lease_charge_ratio/100 lease_charge_ratio,
                    t.customer_ratio/100 customer_ratio,
                    t.down_payment_ratio_from/100 down_payment_ratio_from,
                    t.down_payment_ratio_to/100 down_payment_ratio_to,
                    t.deposit_ratio_from/100 deposit_ratio_from,
                    t.deposit_ratio_to/100 deposit_ratio_to,
                    t.balloon_ratio_from/100 balloon_ratio_from,
                    t.balloon_ratio_to/100 balloon_ratio_to,
                    t.times_from,
                    t.times_to,
                    t.product_name_write
                FROM
                    hls_product_plan_definition t #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="product_plan_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PRODUCT_PLAN_ID"/>
        <bm:field name="product_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRODUCT_TYPE_N"/>
        <bm:field name="product_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRODUCT_NAME"/>
        <bm:field name="lease_charge_ratio" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LEASE_CHARGE_RATIO"/>
        <bm:field name="customer_ratio" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CUSTOMER_RATIO"/>
        <bm:field name="down_payment_ratio_from" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DOWN_PAYMENT_RATIO_FROM"/>
        <bm:field name="down_payment_ratio_to" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DOWN_PAYMENT_RATIO_TO"/>
        <bm:field name="deposit_ratio_from" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DEPOSIT_RATIO_FROM"/>
        <bm:field name="deposit_ratio_to" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DEPOSIT_RATIO_TO"/>
        <bm:field name="balloon_ratio_from" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BALLOON_RATIO_FROM"/>
        <bm:field name="balloon_ratio_to" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BALLOON_RATIO_TO"/>
        <bm:field name="times_from" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TIMES_FROM"/>
        <bm:field name="times_to" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TIMES_TO"/>
        <bm:field name="product_name_write" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRODUCT_NAME_WRITE"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="down_payment_ratio" queryExpression="to_number(${/parameter/@down_payment_ratio}) BETWEEN t.down_payment_ratio_from/100 AND t.down_payment_ratio_to/100"/>
        <bm:query-field name="deposit_ratio" queryExpression="to_number(${/parameter/@deposit_ratio}) BETWEEN t.deposit_ratio_from/100 AND t.deposit_ratio_to/100"/>
        <bm:query-field name="balloon_ratio" queryExpression="to_number(${/parameter/@balloon_ratio}) BETWEEN t.balloon_ratio_from/100 AND t.balloon_ratio_to/100"/>
        <bm:query-field name="times" queryExpression="to_number(${/parameter/@times}) BETWEEN t.times_from AND t.times_to"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter name="enable_flag" enforceOperations="query" expression="t.enable_flag=&apos;Y&apos;"/>
    </bm:data-filters>
</bm:model>
