<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zc
    $Date: 2020年11月11日
    $Revision: 1.0
    $Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="file_name"/>
        <bm:field name="file_path"/>
        <bm:field name="file_size"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                   select fa.file_name,fa.file_path,fa.file_size,ct.order_seq
                    from fnd_atm_attachment fa, fnd_atm_attachment_multi fm,con_contract_content cc,con_clause_templet ct
                   where fa.attachment_id = fm.attachment_id
                     and fm.table_name = 'CON_CONTRACT_CONTENT'
                     and cc.content_id = fm.table_pk_value
                     and cc.templet_id = ct.templet_id
                     and fm.table_pk_value in
                         (select t.content_id
                            from con_contract_content t,con_ele_signer_file cf
                           where t.contract_id = ${@contract_id}
                             and t.templet_id = cf.templet_id
                             and cf.templet_code != 'SETTLE_ADVANCE_OEC')
                          order by ct.order_seq
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
