<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hc  
    $Date: 2015-10-10 下午01:37:01  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="PRJ_CHANCE_V" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    rownum AS row_num,--序号,
                    t1.*
                FROM
                    (SELECT
                        project_status, --项目状况
                        project_status_num,
                        project_name, --项目名称
                        contract_number,       --合同号
                        con_bp_adress,         --是否京津冀
                        con_bp_scale,          --是否有中 小  微
                        bp_name,               --承租人名称
                        bp_business,           --承租人简介
                        bp_industry_big,       --主承租人所属行业大类
                        business_desc,         -- 租赁方式
                        lease_item_short_name, --租赁物
                        finance_amount,        --租赁本金
                        lease_times,           --期数
                        lease_term,            --期限（月）
                        irr,                   --内部收益率
                        irr_n,
                        guarantor_bp,      --保证人
                        notes,             --租金共几期，已回收几期，逾期几期
                        prj_status_name,   --项目报告状态
                        con_status_name ,  --合同状态
                        inception_of_lease,--投放时间
                        org_name,          --责任部门
                        sponsor,           --主办人
                        assist,            --协办人
                        deposit,           --保证金
                        deposit_ratio,     --保证金比例
                        int_rate,
                        deposit_ratio_n,
                        int_rate_n,
                        commission_charge_n,
                        commission_charge,
                        (SELECT SV.CODE_VALUE_NAME AS PRE_RENTAL_BUSINESS
                  FROM SYS_CODE_VALUES_V SV
                 WHERE SV.CODE = 'YES_NO'
                   AND SV.CODE_ENABLED_FLAG = 'Y'
                   AND SV.CODE_VALUE_ENABLED_FLAG = 'Y'
                   AND SV.CODE_VALUE = PV.PRE_RENTAL_BUSINESS) PRE_RENTAL_BUSINESS
                    FROM
                        prj_info_step_v pv
                    ORDER BY
                        project_status_num,
                        inception_of_lease
                    )t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="row_num" expression="rownum"/>
        <bm:field name="project_status"/>
        <bm:field name="project_name"/>
        <bm:field name="contract_number"/>
        <bm:field name="con_bp_adress"/>
        <bm:field name="con_bp_scale"/>
        <bm:field name="bp_name"/>
        <bm:field name="bp_business"/>
        <bm:field name="bp_industry_big"/>
        <bm:field name="deposit_ratio_n"/>
        <bm:field name="int_rate_n"/>
        <bm:field name="irr_n"/>
        <bm:field name="commission_charge_n"/>
        <bm:field name="business_desc"/>
        <bm:field name="lease_item_short_name"/>
        <bm:field name="finance_amount" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="lease_times" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="lease_term"/>
        <bm:field name="irr" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="guarantor_bp"/>
        <bm:field name="notes"/>
        <bm:field name="prj_status_name"/>
        <bm:field name="con_status_name"/>
        <bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date"/>
        <bm:field name="org_name"/>
        <bm:field name="sponsor"/>
        <bm:field name="assist"/>
        <bm:field name="deposit" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="deposit_ratio" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="int_rate" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="commission_charge" databaseType="NUMBER" datatype="java.lang.Double"/>
        <bm:field name="pre_rental_business"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="project_status" queryOperator="like"/>
        <bm:query-field name="bp_name" queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
        <bm:query-field name="bp_industry_big" queryExpression="t1.bp_industry_big like &apos;%&apos;||${@bp_industry_big}||&apos;%&apos;"/>
        <bm:query-field field="con_bp_adress" queryOperator="="/>
        <bm:query-field field="con_bp_scale" queryOperator="="/>
        <bm:query-field field="pre_rental_business" queryOperator="="/>
    </bm:query-fields>
</bm:model>
