<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Administrator  
    $Date: 2017-8-21 上午10:36:49  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            SELECT t1.*
              FROM (SELECT t.*,
                           (SELECT c.contract_number
                              FROM con_contract c
                             WHERE c.contract_id = t.contract_id) contract_number,
                           (SELECT m.bp_name
                              FROM con_contract c, hls_bp_master m
                             WHERE c.contract_id = t.contract_id
                               AND c.bp_id_tenant = m.bp_id) bp_name,
                           (SELECT nvl(m.extra_nam,m.bp_name)
                              FROM hls_bp_master m, con_contract c
                             WHERE m.bp_id = c.bp_id_agent_level1
                               AND c.contract_id = t.contract_id) bp_agent,
                           decode(t.status,
                                  'NEW',
                                  '新建',
                                  'SUCCESS',
                                  '成功',
                                  'FAIL',
                                  '失败',
                                  '处理中') status_desc,
                           to_char(t.receive_date, 'yyyy-mm-dd hh24:mi:ss') receive_date_desc
                      FROM hls_ebank_withhold_detail t) t1
                 #WHERE_CLAUSE#
                 order by t1.batch_id desc
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                begin
                    hls_ebank_batch_pkg.import_withhold_excel
                    (
                        p_header_id    =>${/parameter/@header_id},
                        p_batch_id     =>${/parameter/@batch_id},
                        p_user_id      =>${/session/@user_id}
                    );
                end;]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                begin
                    hls_ebank_batch_pkg.import_withhold_excel_check
                    (
                        p_header_id    =>${/model/header/record/@header_id},
                        p_batch_id     =>${/parameter/@batch_id},
                        p_user_id      =>${/session/@user_id}
                    );
                end;]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="batch_id" queryExpression="t1.batch_id=${@batch_id}"/>
    </bm:query-fields>
</bm:model>
