<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT faa.file_name,
                       faa.file_path,
                       faa.attachment_id,
                       m.table_name,
                       m.table_pk_value,
                       m.record_id
                   FROM fnd_atm_attachment         faa,
                       fnd_atm_attachment_multi   m,
                       con_clause_templet         t,
                       con_contract_content_v     cc,
                       con_contract_download_temp pt
                 WHERE faa.attachment_id = m.attachment_id
                   AND m.table_name = 'CON_CONTRACT_CONTENT'
                   AND m.table_pk_value = cc.content_id
                   AND t.doc_plugin_flag = 'Y'
                   AND t.templet_id = cc.templet_id
                   AND cc.contract_id = pt.contract_id
                   AND pt.session_id = ${/session/@session_id}
                   AND t.templet_code = ${/parameter/@templet_code}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="table_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_NAME" required="true"/>
        <bm:field name="table_pk_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_PK_VALUE" required="true"/>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" required="true"/>
        <bm:field name="attachment_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_ID" required="true"/>
        <bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
        <bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
    </bm:fields>
</bm:model>
