<?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.virtual_con_name
                FROM
                    prj_project pp
                WHERE
                    pp.data_class = 'VIRTUAL_CON' AND
                    EXISTS
                    (SELECT
                        1
                    FROM
                        hn_atm_complement hac
                    WHERE
                        hac.document_id = pp.project_id AND
                        hac.status      = 'APPROVED'
                    ) and not EXISTS (select 1
          from hn_virtual_con_change_req tt
         where tt.project_id = pp.project_id
           and tt.status <> 'APPROVED')) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID"/>
        <bm:field name="virtual_con_number" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="140" forDisplay="true" forQuery="true" physicalName="VIRTUAL_CON_NUMBER" prompt="合同编号"/>
        <bm:field name="virtual_con_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="280" forDisplay="true" forQuery="true" physicalName="VIRTUAL_CON_NAME" prompt="合同名称"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="virtual_con_number" queryExpression="t1.virtual_con_number like ${@virtual_con_number}"/>
        <bm:query-field name="virtual_con_name" queryExpression="t1.virtual_con_name like ${@virtual_con_name}"/>
    </bm:query-fields>
</bm:model>
