<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-4-27 上午10:52:06  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
       select * from (
       select ---h.bp_name, 
       pb.bp_role_id_n,--客户名称
       hbml.binary_classification_n,
       pb.bp_id,
       --h.bp_id,
       pb.chance_id,       
       h.legal_person, --法人代表
       --h.setup_date, --成立时间
        to_char(h.setup_date,'yyyy')||'年'||to_char(h.setup_date,'mm')||'月'||to_char(h.setup_date,'dd')||'日' setup_date,
       hp.country_id_n || hp.province_id_n || hp.city_id_n ||
       hp.district_id_n || hp.address detailed_address,--地址
       pb.detail_industry, --所属行业及细分市场
       pb.operation_status, --经营状况及行业地位
       pb.financial_status, --财务状况
       pb.shareholder, --公司股东及实际控制人
       pb.equity_transfer, --股权变动情况
       pb.equity_pledge, --股权质押或代持情况
       pb.relation, --关联方情况
       pb.co_history --既往合作项目情况 
  from hls_bp_master_lv h,
       hls_bp_master_address_lv hp,
        hls_bp_master_lv hbml,
      (SELECT * FROM prj_chance_bp_lv pcbl
      where   pcbl.bp_category='GUARANTOR'
 --AND  pcbl.bp_type='GUARANTOR'
 ) pb
 where hp.address_type = 'DOC_SENT_ADDRESS'--邮寄地址
 and  pb.bp_id=hp.bp_id
 and pb.bp_id=hbml.bp_id
 and h.bp_id(+) = pb.bp_id) t1
 #WHERE_CLAUSE#
 
 ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="chance_id" queryExpression="chance_id=${@chance_id}"/>
    </bm:query-fields>
</bm:model>
