con_file_download.lwm 6.55 KB
Newer Older
chenzhuo's avatar
chenzhuo committed
1 2 3
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
4
        <bm:field name="attachment_id"/>
chenzhuo's avatar
chenzhuo committed
5 6 7 8 9 10
        <bm:field name="file_name"/>
        <bm:field name="file_path"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
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
select fa.file_name,fa.file_path,fa.attachment_id
                   from prj_cdd_item pi,PRJ_CDD_ITEM_CHECK pc,fnd_atm_attachment_multi fm,fnd_atm_attachment fa
                  where pc.cdd_item_id = pi.cdd_item_id
                   and fm.table_pk_value = pc.check_id
                   and fm.attachment_id = fa.attachment_id
                   and fm.table_name = 'CON_CONTRACT'
                   and pi.cdd_item in
                        (select decode(cf.templet_code,
                                'LEASE_CONTRACT_MASTER_OEC','CONTRACT',
                                'LEASE_REQUEST_OEC','LEASE_ITEM_REQ',
                                'LEASE_INFO_OEC','TN_GU_INFO',
                                'LEASE_SURE_PER_OEC','GUARANTEE_LETTER_OEC',
                                'LEASE_SURE_SEL_OEC','S_GUARANTEE_LETTER_OEC',
                                'LEASE_CHECK_OEC','CHECK_INFO',
                                'LEASE_SURE_PAR_OEC','SPOUSE_COMMITMENT',
                                'LEASE_SALE_RL_OEC','PUR_CONTRACT',
                                'LEASE_SALE_YL_OEC','PUR_CONTRACT',
                                'LEASE_SURE_BUS_OEC','GUARANTEE_LETTER_OEC',
                                'R_LEASE_CONTRACT_MASTER_OEC','CONTRACT',
                                'R_LEASE_REQUEST_OEC','LEASE_ITEM_REQ',
                                'R_LEASE_INFO_OEC','TN_GU_INFO',
                                'R_LEASE_SURE_PER_OEC','GUARANTEE_LETTER_OEC',
                                'R_LEASE_SURE_SEL_OEC','S_GUARANTEE_LETTER_OEC',
                                'R_LEASE_SURE_BUS_OEC','GUARANTEE_LETTER_OEC',
                                'R_LEASE_CHECK_OEC','CHECK_INFO',
                                'R_LEASE_SURE_PAR_OEC','SPOUSE_COMMITMENT',
                                'R_LEASE_SALE_OEC','PUR_CONTRACT',
                                'S_LEASE_CONTRACT_MASTER_B_OEC','CONTRACT',
                                'S_LEASE_PAY_OEC','CASHFLOW_INFO',
                                'S_LEASE_CHECK_OEC','CHECK_INFO',
                                'S_LEASE_SURE_PER_OEC','GUARANTEE_LETTER_OEC',
                                'S_LEASE_SURE_PAR_OEC','SPOUSE_COMMITMENT',
                                'S_LEASE_SURE_F_OEC','S_GUARANTEE_LETTER_OEC',
                                'S_LEASE_SURE_BUS_OEC','GUARANTEE_LETTER_OEC',
                                'S_LEASE_ORDER_OEC','ITEM_TRAN_NOTICE',
                                'S_LEASE_PAY_REQ_OEC','PAYMENT_REQ',
47 48 49 50 51 52 53 54 55 56 57 58 59 60
                                'S_LEASE_MOR_OEC','MORT_CONTRACT',
                                'FINANCE_LEASE_CONTRACT_TJ_S_E',  --update by xsh35973 铁甲电子签约
                                'FINANCE_LEASE_CONTRACT_TJ_S_E',
                                'FINANCE_LEASE_CONTRACT_TJ_E',
                                'FINANCE_LEASE_CONTRACT_TJ_E',
                                'CON_COLLECTION_PAYMENT_TJ_E',
                                'CON_COLLECTION_PAYMENT_TJ_E',
                                'CON_CONTRACT_MORTGAGE_TJ_E',
                                'CON_CONTRACT_MORTGAGE_TJ_E',
                                'PERSONAL_CREDIT',
                                'PERSONAL_CREDIT',
                                'FINANCE_LEASE_CONTRACT_TJ_FR_E',
                                'FINANCE_LEASE_CONTRACT_TJ_FR_E',
                                'CON_GUR_NP',
gzj34291's avatar
gzj34291 committed
61 62 63 64 65 66 67 68 69 70 71
                                'CON_GUR_NP',
                                'FINANCE_LEASE_CONTRACT_FR_KJ_E','FINANCE_LEASE_CONTRACT_FR_KJ_E',--update by gzj 北京卡家电子签约
                                'FINANCE_LEASE_CONTRACT_KJ_FR_E','FINANCE_LEASE_CONTRACT_KJ_FR_E',
                                'FINANCE_LEASE_CONTRACT_KJ_S_E','FINANCE_LEASE_CONTRACT_KJ_S_E',
                                'FINANCE_LEASE_CONTRACT_KJ_E','FINANCE_LEASE_CONTRACT_KJ_E',
                                'CSH_PAYMENT_REQ_KJ_1_E','CSH_PAYMENT_REQ_KJ_1_E',
                                'CON_CONTRACT_MORTGAGE_KJ_E','CON_CONTRACT_MORTGAGE_KJ_E',
                                'LEASE_CONTRACT_PAR_KJ_E','LEASE_CONTRACT_PAR_KJ_E',
                                'LEASE_CONTRACT_PAR_KJ_1_E','LEASE_CONTRACT_PAR_KJ_1_E',
                                'CON_COLLECTION_PAYMENT_KJ_E','CON_COLLECTION_PAYMENT_KJ_E'
                                )
72 73 74
                    from con_ele_signer_file cf, con_contract_ele_signer cs
                   where cf.con_ele_signer_id = cs.con_ele_signer_id
                     and cs.contract_id = ${@contract_id}
75
                     and ((('AGENT' not in (select cb.bp_category
76 77 78
                     from con_contract_bp cb, hls_bp_master hm
                    where cb.bp_id = hm.bp_id
                      and hm.social_code = ${@id_no}
79 80 81 82 83 84
                      and cb.contract_id = cs.contract_id) or
                    not exists (select 1
                           from con_contract_bp cb, hls_bp_master hm
                          where cb.bp_id = hm.bp_id
                            and hm.social_code = ${@id_no}
                            and cb.contract_id = cs.contract_id))
85 86 87 88 89 90
                     and exists (select 1 from hls_doc_file_templet_signer hs,con_clause_templet ct,hls_doc_file_templet ht
                                        where hs.templet_id = ht.templet_id
                                         and ht.templet_code = ct.templet_code
                                         and ct.templet_id = cf.templet_id
                                         and hs.enable_flag = 'Y'
                                         and hs.signer_category not in ('AGENCY_STORE_SEAL','AGENCY_STORE_SIGN','HONGLING_SEAL','HONGLING_SIGN')))
91
                     or 'AGENT' in (select cb.bp_category
92 93 94
                   from con_contract_bp cb, hls_bp_master hm
                  where cb.bp_id = hm.bp_id
                    and hm.social_code = ${@id_no}
95
                    and cb.contract_id = cs.contract_id)))
96 97 98 99 100
                    and pi.cdd_list_id =
                        (select cc.cdd_list_id
                           from con_contract cc
                          where cc.contract_id = ${@contract_id}
                            and cc.data_class = 'NORMAL')
101
                    order by pi.order_seq
chenzhuo's avatar
chenzhuo committed
102 103 104 105
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>