<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2013-11-6 下午02:26:55  
    $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
    t1.*
FROM
    (SELECT
        a.file_name,
        a.file_path,
        a.file_type_code,
        r.document_id,
        i.description,
        upper(r.document_table)document_table
    FROM
        prj_cdd_item_check c,
        prj_cdd_item_doc_ref r,
        fnd_atm_attachment_multi m,
        fnd_atm_attachment a,
        prj_cdd_item i
    WHERE
        a.attachment_id   =m.attachment_id AND
        m.table_pk_value  =TO_CHAR(c.check_id) AND
        r.check_id        =c.check_id AND
        a.file_type_code IN ('jpg','jpeg','bmp','gif')
        and i.cdd_item_id = c.cdd_item_id
        and i.project_tab_group = (select a.attachment_tab_group
  from hls_doc_layout_tab a
 where a.layout_code = 'PROJECT_MODIFY'
   AND A.TAB_CODE = 'C_ACT_CTRLER')
    )t1
WHERE
    t1.document_id in
       (select t.prj_bp_id from PRJ_PROJECT_ACT_CTRLER_HD t where t.project_id = ${@project_id})
    and t1.document_table = 'PRJ_PROJECT_ACT_CTRLER_HD'
       
              
              
              ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
