<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang 
    $Date: 2014-11-26 下午04:24:11  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    faa.file_name,
                    faa.file_path,
					(select t.bp_name from prj_project_lv t where t.project_id = ${@project_id}) bp_id_tenant_n,
                    (select t.project_number from prj_project_lv t where t.project_id = ${@project_id}) project_number
                FROM
                    prj_project_content doc,
                    fnd_atm_attachment_multi fam,
                    fnd_atm_attachment faa
                WHERE
                    doc.content_print_flag = 'Y' AND
                    doc.content_id         = NVL(${@content_id}, doc.content_id) AND
                    doc.project_id        = NVL(${@project_id}, doc.project_id) AND
                    fam.table_name         = 'PRJ_PROJECT_CONTENT' AND
                    fam.table_pk_value     = doc.content_id AND
                    fam.attachment_id      = faa.attachment_id and
                    doc.quotation_id       = ${@quotation_id}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
        <bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
        <bm:field name="bp_id_tenant_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER"/>
    </bm:fields>
</bm:model>
