<?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(
            select cc.contract_id,
			       cc.contract_number,
			       cc.contract_name,
			       cc.hn_industry_classification, --行业分类
			       cc.bp_id_tenant,
					             (SELECT yl.bp_name
					                FROM hls_bp_master yl
					               WHERE yl.bp_id = cc.bp_id_tenant) lessee_name, --主承租人                    
			       sdic_report_pkg.get_contract_bp_name(p_contract_id => cc.contract_id,
					                                                  p_bp_category => 'TENANT',
					                                                  p_bp_type     => 'TENANT_SEC') lessee_name_sec, --次承租人
			       sdic_report_pkg.get_prj_bp_name(p_project_id  => cc.project_id,
					                                             p_bp_category => 'GUARANTOR') guarantor_name, --主担保人  
			       cc.annual_pay_times,                      --支付频率(年)
			       cc.lease_times,                           --还款期数
			       cc.price_list,
			       (select tt.description
			          from hls_price_list tt
			         where tt.price_list = cc.price_list) price_list_n,       --价目表(报价方式)
			       cc.adjust_rate_type,                   --调息类型(规则)
			       cc.project_id
			  from con_contract cc
			 WHERE cc.data_class = 'NORMAL'
			   AND NVL(cc.hn_adjust_review_flag, 'N') = 'Y'
			   ) t1 #WHERE_CLAUSE# order by t1.contract_number
			]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="contract_number" queryExpression="t1.contract_number like &apos;%&apos;||${@contract_number}||&apos;%&apos;"/>
        <bm:query-field name="contract_name" queryExpression="t1.contract_name like &apos;%&apos;||${@contract_name}||&apos;%&apos;"/>
        <bm:query-field name="hn_industry_classification_n" queryExpression="t1.hn_industry_classification like &apos;%&apos;||${@hn_industry_classification}||&apos;%&apos;"/>
        <bm:query-field name="lessee_name" queryExpression="t1.lessee_name like &apos;%&apos;||${@lessee_name}||&apos;%&apos; or t1.lessee_name_sec like &apos;%&apos;||${@lessee_name}||&apos;%&apos;"/>
        <bm:query-field name="guarantor_name" queryExpression="t1.guarantor_name like &apos;%&apos;||${@guarantor_name}||&apos;%&apos;"/>
        <bm:query-field name="annual_pay_times_n" queryExpression="t1.annual_pay_times like &apos;%&apos;||${@annual_pay_times}||&apos;%&apos;"/>
        <bm:query-field name="price_list_n" queryExpression="t1.price_list=${@price_list}"/>
        <bm:query-field name="adjust_rate_type_n" queryExpression="t1.adjust_rate_type like &apos;%&apos;||${@adjust_rate_type}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
