<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: 26887cz
    $Date: 2021-10-14 下午03:16:44
    $Revision: 1.0
    $Purpose: 保证金退款打印
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:fields>
        <bm:field name="file_type"/>
        <bm:field name="table_name"/>
        <bm:field name="table_pk_value"/>
        <bm:field name="attachment_id"/>
        <bm:field name="file_name"/>
        <bm:field name="file_size"/>
        <bm:field name="file_path"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
           SELECT *
  FROM (SELECT fa.attachment_id,
               fa.file_name,
               fa.file_size,
               fa.file_path,
               UPPER(fa.file_type_code) file_type,
               fam.table_name,
               fam.table_pk_value
          FROM fnd_atm_attachment fa
          LEFT OUTER JOIN fnd_atm_attachment_multi fam
            ON fa.attachment_id = fam.attachment_id) fam
        WHERE fam.table_name = ${@table_name}
        and fam.table_pk_value = ${@table_pk_value}
        ORDER BY file_name
                ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            	begin
            		hls_doc_file_templet_pkg.init_hls_doc_file_content(
            		  p_document_id    =>${@document_id},
                      p_document_table =>${@document_table},
                      p_user_id        =>${/session/@user_id});
            	end;
        	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
