<?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 con_credit_report partition (${:@partition}) 去掉分区速度更快。。。。
	    	  select * from con_credit_report partition
	    	 #WHERE_CLAUSE#
	    	]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:parameters >
                <bm:parameter name ="partition" dataType="java.lang.String" input ="false" output ="true" outputPath="@partition" />
            </bm:parameters >
            <bm:update-sql><![CDATA[
                begin
                    con_credit_report_pkg.get_partition
                    (
                        p_internal_period_num=>${@internal_period_num},
                        p_partition=>${@partition}
                    );
                end;]]>
            </bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="report_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="calc_date" databaseType="DATE" datatype="java.util.Date"/>
        <bm:field name="period_name" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="bp_agent_code" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="bp_agent_name" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="bp_agent_name_extra" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="living_address" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="bp_tenant_code" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="bp_tenant_name" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="sys_level" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="division" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="division_n" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="lease_channel" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="lease_channel_n" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="business_type" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="business_type_n" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="machine_number" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="pattern" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="equipment_number" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="sale_date" databaseType="DATE" datatype="java.util.Date"/>
        <bm:field name="lease_execution_date" databaseType="DATE" datatype="java.util.Date"/>
        <bm:field name="lease_end_date" databaseType="DATE" datatype="java.util.Date"/>
        <bm:field name="contract_number" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="product_name" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="sub_price_list_name" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="as_item_source" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="special_policy" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="finance_amount" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="down_payment" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="quantity" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="repayment_date_day" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="lease_times" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="receipt_lease_times" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="months_payment_amount" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="expire_rental" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="expire_lease_charge" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="expire_delay_interest" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="expire_down_payment" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="expire_down_payment_int" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="received_rental" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="received_penalty" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="received_lease_charge" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="received_delay_interest" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="received_down_payment" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="received_down_payment_int" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="received_advance" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="banance_principal" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="dcfl_banance_principal" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="overdue_times" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="his_max_overdue_times" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="total_overdue_date" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="overdue_principal" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="overdue_interest" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="overdue_lease_charge" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="overdue_delay_interest" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="overdue_down_payment" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="overdue_down_payment_int" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="overdue_amount" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="unexpired_principal" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="unexpired_interest" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="unexpired_lease_charge" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="unexpired_delay_interest" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="unexpired_down_payment" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="unexpired_down_payment_int" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="unreceived_down_payment" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="unreceived_residual" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="cell_phone" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="payment_type" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="factory_division" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="factory_amount" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="sap_number" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="guarantee_info" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="financial_institution" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="financial_ins_number" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="agent_advance_payment" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="loss_sharing_mark" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="authorization_version" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="ccr_reason" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="creditor_distinction" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="first_delay_flag" databaseType="VARCHAR" datatype="java.lang.String"/>
        <bm:field name="asset_flag" databaseType="VARCHAR" datatype="java.lang.String"/>

    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="contract_id" queryExpression="contract_id = ${@contract_id}"/>
        <bm:query-field name="pattern" queryExpression="pattern = ${@pattern}"/>
        <bm:query-field name="machine_number" queryExpression="machine_number = ${@machine_number}"/>
        <bm:query-field name="bp_agent_code" queryExpression="bp_agent_code = ${@bp_agent_code}"/>
        <bm:query-field name="lease_execution_date_from" queryExpression="lease_execution_date &gt;= to_date(${@lease_execution_date_from},'yyyy-mm-dd')"/>
        <bm:query-field name="lease_execution_date_to" queryExpression="lease_execution_date &lt;= to_date(${@lease_execution_date_to},'yyyy-mm-dd')"/>
        <bm:query-field name="bp_tenant_name" queryExpression="bp_tenant_name like  &apos;%&apos; || ${@bp_tenant_name} || &apos;%&apos;"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter name="calc_date" expression="calc_date = to_date(${@calc_date},'yyyy-mm-dd')"/>
        <bm:data-filter name="authorize" expression="EXISTS (SELECT 1 FROM aut_trx_user_authorize a1, aut_owner_user_authorize a2 WHERE a1.trx_category = 'CONTRACT' AND a1.trx_id = contract_id AND trunc(SYSDATE) BETWEEN a1.start_date AND nvl(a1.end_date, trunc(SYSDATE))  AND a1.user_id = a2.owner_user_id AND a1.trx_category = a2.trx_category AND a2.authorized_user_id = ${/session/@user_id} AND trunc(SYSDATE) BETWEEN a2.start_date AND nvl(a2.end_date, trunc(SYSDATE)))"/>
    </bm:data-filters>

</bm:model>
