<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Administrator  
    $Date: 2015-5-4 下午5:11:59  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                        t1.CHANCE_ID,
                        t1.CHANCE_NUMBER,
                        t1.DOCUMENT_TYPE,
                        t1.DOCUMENT_TYPE_N,
                        t1.DOCUMENT_CATEGORY,
                        t1.DOCUMENT_CATEGORY_N,
                        t1.BUSINESS_TYPE,
                        t1.BUSINESS_TYPE_N,
                        t1.CHANCE_STATUS,
                        t1.CHANCE_STATUS_N,
                        t1.COMPANY_ID,
                        t1.COMPANY_ID_N,
                        t1.LEASE_ORGANIZATION,
                        t1.LEASE_ORGANIZATION_N,
                        t1.LEASE_CHANNEL,
                        t1.LEASE_CHANNEL_N,
                        t1.DIVISION,
                        t1.DIVISION_N,
                        t1.OWNER_USER_ID,
                        t1.OWNER_USER_ID_N,
                        t1.EMPLOYEE_ID,
                        t1.EMPLOYEE_ID_N,
                        t1.UNIT_ID,
                        t1.UNIT_ID_N,
                        t1.EMPLOYEE_ID_OF_MANAGER,
                        t1.EMPLOYEE_ID_OF_MANAGER_N,
                        t1.BP_NAME,
                        t1.PRICE_LIST,
                        t1.PRICE_LIST_N,
                        t1.CURRENCY,
                        t1.CURRENCY_N,
                        t1.FINANCE_AMOUNT,
                        t1.LEASE_TIMES,
                        t1.ANNUAL_PAY_TIMES,
                        t1.ANNUAL_PAY_TIMES_N,
                        t1.LEASE_START_DATE,
                        t1.LEASE_ITEM_SHORT_NAME,
                        t1.CHANCE_SOURCE,
                        t1.CHANCE_SOURCE_N,
                        t1.COUNTRY_ID,
                        t1.COUNTRY_ID_N,
                        t1.PROVINCE_ID,
                        t1.PROVINCE_ID_N,
                        t1.CITY_ID,
                        t1.CITY_ID_N,
                        t1.DISTRICT_ID,
                        t1.DISTRICT_ID_N,
                        t1.STREET,
                        t1.ADDRESS,
                        t1.BP_CLASS,
                        t1.BP_CLASS_N,
                        t1.INDUSTRY,
                        t1.INDUSTRY_N,
                        t1.TEXT,
                        t1.CONTACT_PERSON_1,
                        t1.POSITION_1,
                        t1.CELL_PHONE_1,
                        t1.PHONE_1,
                        t1.EMAIL_1,
                        t1.CONTACT_INFO_1,
                        t1.CONTACT_PERSON_2,
                        t1.POSITION_2,
                        t1.CELL_PHONE_2,
                        t1.PHONE_2,
                        t1.EMAIL_2,
                        t1.CONTACT_INFO_2,
                        t1.EXPECT_FINANCING_DATE,
                        t1.LEASE_ITEM_AMOUNT,
                        t1.DOWN_PAYMENT,
                        t1.VENDER_NAME,
                        t1.INSTALLATION_SITE,
                        t1.FIRST_CONTACT_DATE,
                        t1.POSSIBILITY,
                        t1.COMPETITOR,
                        t1.LISTED_FLAG,
                        t1.LISTED_FLAG_N,
                        t1.STAFF_NUM,
                        t1.PRIME_OPERATING_REVENUE,
                        t1.NET_PROFIT,
                        t1.FIN_STATEMENT_CURRENCY,
                        t1.FIN_STATEMENT_CURRENCY_N,
                        t1.REF_V01,
                        t1.REF_V02,
                        t1.REF_V03,
                        t1.REF_V04,
                        t1.REF_V05,
                        t1.REF_V06,
                        t1.REF_V07,
                        t1.REF_V08,
                        t1.REF_V09,
                        t1.REF_V10,
                        t1.REF_N01,
                        t1.REF_N02,
                        t1.REF_N03,
                        t1.REF_N04,
                        t1.REF_N05,
                        t1.REF_N06,
                        t1.REF_N07,
                        t1.REF_N08,
                        t1.REF_N09,
                        t1.REF_N10,
                        t1.REF_D01,
                        t1.REF_D02,
                        t1.REF_D03,
                        t1.REF_D04,
                        t1.REF_D05,
                        t1.REF_D06,
                        t1.REF_D07,
                        t1.REF_D08,
                        t1.REF_D09,
                        t1.REF_D10,
                        t1.WFL_INSTANCE_ID,
                        t1.ASSISTING_PM_A,
                        t1.ASSISTING_PM_A_N,
                        t1.ASSISTING_PM_B,
                        t1.ASSISTING_PM_B_N,
                        t1.PAYMENT_METHOD,
                        t1.PAYMENT_METHOD_N,
                        t1.NOMINAL_PRICE,
                        t1.PRJ_INSTRO,
                        t1.REPAY_RESOURCE,
                        t1.RISK_CTM,
                        t1.L_INCERESE_M,
                        bm.group_membership,
                        bm.income_ly,
                        bm.hospital_rank,
                        bm.bussiness_scope,
                        bm.BUSINESS_LICENSE_NUM,
                        bm.ORGANIZATION_CODE,
                        bm.REGISTERED_CAPITAL,
                        bm.PAID_UP_CAPITAL,
                        bm.FOUNDED_DATE,
                        bm.LEGAL_FORM,
                        bm.LEGAL_PERSON,
                        bm.REGISTERED_PLACE,
                        bm.primary_business,
                        t1.CREATED_BY,
                        t1.CREATION_DATE,
                        t1.LAST_UPDATED_BY,
                        t1.LAST_UPDATE_DATE,
                        bm.actual_controller,
                        bm.company_nature_n,
                        bm.company_type,
                        bm.setup_date,
                        bm.loan_card_num
                    FROM
                        PRJ_CHANCE_V t1,
                        hls_bp_master_lv bm
                    WHERE
                        bm.bp_id = t1.bp_id
                    ) t 
                    #WHERE_CLAUSE#
                ORDER BY
                    t.creation_date DESC,
                    t.chance_number DESC
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="chance_id" queryExpression="t.chance_id=${@chance_id}"/>
    </bm:query-fields>
</bm:model>
