<?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 ct.ele_content_flag = 'Y'
                     and ct.enabled_flag = 'Y'
                     and ct.templet_usage = 'AGENT_CONTRACT'
                     and fm.table_pk_value in
                         (select t.content_id
                            from con_contract_content t
                           where t.contract_id = ${@contract_id}
                             and t.clause_usage != 'CHANGE_REQ')
                          order by ct.order_seq
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
