prj_maintain_query.lwm 3.44 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: mumu  
    $Date: 2014-7-27 上午03:23:25  
    $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 * from
                    ( select 'PRJ_CDD_ITEM_CHECK' document_table,
                    t.project_id document_id,
                    t.document_category,
                    pci.cdd_item_id,
                    pci.cdd_list_id,
                    pci.cdd_item,
                    pci.description,
                    pci.file_attribute,
                    pci.file_require,
                    (select t1.code_value_name from sys_code_values_v t1 
                      where t1.code='HLS_FILE_REQUIRE' and t1.code_value = pci.file_require) as file_require_n,
                    (select t1.code_value_name from sys_code_values_v t1 
                      where t1.code='HLS_FILE_ATTRIBUTE' and t1.code_value = pci.file_attribute) as file_attribute_n,
                    pci.enabled_flag,
                    pci.note,
                    NVL(pcc.send_flag,'N') send_flag,
                    NVL(pci.sys_flag, 'N') sys_flag,
                    NVL(pci.supplement_flag, 'N') supplement_flag,
                    pcc.paper_required,
                    pcc.attachment_required,
                    pcc.not_applicable,
                    pcc.check_id,
                    pci.order_seq,
                    pci.sign_required_flag,
                    pci.project_required_flag,
                    decode(pcc.send_flag,'Y',(select to_char(pr.creation_date,'yyyy-mm-dd') from prj_cdd_item_doc_ref pr where pr.check_id = pcc.check_id and rownum=1) ,NULL) save_date,
                    decode(pcc.send_flag,'Y',(select s.description from sys_user s,prj_cdd_item_doc_ref pr where user_id= pr.last_updated_by and pr.check_id=pcc.check_id and rownum=1),NULL) save_name,
                    hls_sys_upload_pkg.get_atm_file_href(p_table_pk_value => pcc.check_id,p_source_type => 'PRJ_CDD_ITEM_CHECK',p_user_id => ${/session/@user_id}) AS file_name
                    --(SELECT
                    --    MAX(fm.creation_date)
                    --FROM
                    --    fnd_atm_attachment_multi fm
                    --WHERE
                    --    fm.table_name     = 'PRJ_CDD_ITEM_CHECK' AND
                    --    fm.table_pk_value = pcc.check_id
                    --) creation_date
                FROM
                    prj_cdd_item pci,
                    prj_cdd_item_check pcc,
                    --prj_cdd_item_doc_ref pr,
                    prj_project t
                WHERE
                    pci.cdd_item_id  = pcc.cdd_item_id(+) AND
                    t.cdd_list_id    = pci.cdd_list_id AND
                    pci.cdd_list_id  = t.cdd_list_id AND
                    --pr.check_id    = pcc.check_id AND
                    pci.project_tab_group = '1' AND 
                    pci.project_display_flag = 'Y' AND
                    pci.parent_cdd_item_id is null and
                    pci.enabled_flag = 'Y' AND
                    t.project_id     = ${/parameter/@project_id}) t1 
                   order by order_seq]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter inputPath="/session/@user_id"/>
                <bm:parameter inputPath="/parameter/@project_id"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>