<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei5743
$Date: 2024-5-31 上午10:38:31
$Revision: 1.0
$Purpose: 电子签约附件大小错误更新
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:fields>
        <bm:field name="attachment_id"/>
        <bm:field name="source_pk_value"/>
        <bm:field name="file_path"/>
        <bm:field name="file_size"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                 select F.ATTACHMENT_ID,F.SOURCE_PK_VALUE,F.FILE_PATH,F.FILE_SIZE
                 from fnd_atm_attachment f where f.creation_date>sysdate-1/24
                 and f.File_Path like substr(${@ele_con_file_path},1,2) || '%'
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                BEGIN
                 UPDATE fnd_atm_attachment f
                 set f.file_size=${@file_size},
                     f.last_update_date=sysdate,
                     f.last_updated_by= nvl(${/session/@user_id},1)
                     where f.attachment_id=${@attachment_id}
                     and f.source_pk_value=${@source_pk_value};
                     COMMIT;
                END;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
