<?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.project_number,
                    pp.project_name,
                    pci.cdd_item,
                    pci.description cdd_item_desc,
                    pci.note,
                    pcic.dd_check_flag,
                    pcic.dd_photo_flag
                FROM
                    prj_project pp,
                    prj_cdd_item pci,
                    prj_cdd_item_check pcic,
                    prj_cdd_item_doc_ref pidc
                WHERE
                    pp.cdd_list_id      = pci.cdd_list_id AND
                    pci.cdd_item_id     = pcic.cdd_item_id AND
                    pcic.check_id       = pidc.check_id AND
                    pidc.document_table = 'PRJ_PROJECT' AND
                    pidc.document_id    = pp.project_id) 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" required="true"/>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER" required="true"/>
        <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NAME"/>
        <bm:field name="cdd_item" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CDD_ITEM" required="true"/>
        <bm:field name="cdd_item_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CDD_ITEM_DESC"/>
        <bm:field name="note" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTE"/>
        <bm:field name="dd_check_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DD_CHECK_FLAG"/>
        <bm:field name="dd_photo_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DD_PHOTO_FLAG"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="project_number" queryExpression="t1.project_number=${@project_number}"/>
    </bm:query-fields>
</bm:model>
