<?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
                    pp.project_id,
                    pp.bp_id_tenant_n bp_name,
                    pp.virtual_con_number document_number,
                    pp.virtual_con_name document_name
                FROM
                    prj_project_virtual_con_lv pp
                WHERE
                    pp.project_id = ${/parameter/@project_id}
                UNION
                SELECT
                    pp.project_id,
                    pp.bp_name,
                    pp.project_number document_number,
                    pp.project_name document_name
                FROM
                    prj_project_lv pp
                WHERE
                    pp.data_class='NORMAL' AND
                    NOT EXISTS
                    (SELECT 1 FROM prj_project pp1 WHERE pp1.ref_project_id = pp.project_id
                    )
                    and pp.project_id = ${/parameter/@project_id}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
