<?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
                        pp.project_id,
                        pp.virtual_con_number,         --合同号
                        pp.project_name,               --项目名称
                        pp.hn_industry_classification, --集团内行业分
                        pp.business_type,
                        (SELECT
                            hbtv.description
                        FROM
                            hls_business_type_v hbtv
                        WHERE
                            hbtv.business_type=pp.business_type
                        ) lease_form,             --租赁形式
                        pp.binary_classification, --集团内二级分类
                        (SELECT
                            scvv.code_value_name
                        FROM
                            sys_code_values_v scvv
                        WHERE
                            scvv.code      IN ('WITHIN_GROUP', 'MARKETIZATION') AND
                            scvv.code_value = pp.binary_classification
                        ) binary_classification_n, --电源类型
                        pp.bp_id_tenant,           --主承租人id
                        (SELECT hbm.bp_name FROM hls_bp_master hbm WHERE hbm.bp_id=pp.bp_id_tenant
                        ) bp_name,                                                                                                    --承租人
                        (sdic_report_pkg.get_prj_bp_name(p_project_id => pp.project_id, p_bp_category => 'GUARANTOR')) guarantor_name --担保人
                    FROM
                        prj_project pp
                    WHERE
                        pp.data_class        ='VIRTUAL_CON' AND
                        pp.content_wfl_status='APPROVED'
                    ) t1 #WHERE_CLAUSE#
                ORDER BY
                    t1.virtual_con_number
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="virtual_con_number" queryExpression="t1.virtual_con_number like &apos;%&apos;||${@virtual_con_number}||&apos;%&apos;"/>
        <bm:query-field name="project_name" queryExpression="t1.project_name like &apos;%&apos;||${@project_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="lease_form_n" queryExpression="t1.lease_form like &apos;%&apos;||${@lease_form}||&apos;%&apos;"/> -->
        <bm:query-field name="business_type_n" queryExpression="t1.business_type=${@business_type}"/>
        <bm:query-field name="binary_classification_n" queryExpression="t1.binary_classification_n like &apos;%&apos;||${@binary_classification_n}||&apos;%&apos;"/>
        <bm:query-field name="bp_name" queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
        <bm:query-field name="guarantor_name" queryExpression="t1.guarantor_name like &apos;%&apos;||${@guarantor_name}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
