<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: luochenglong
    $Date: 2023-02-10 早上 11:03:31
    $Revision: 1.0
    $Purpose: 电子档案池bm
-->
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" >
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			SELECT t1.pool_id,
    			       t1.primary_field,
                       t1.internal_period_num,
                       t1.base_archive_code,
                       t1.archive_type,
                       t1.document_id,
                       t1.document_number,
                       t1.document_info,
                       t1.post_status,
                       (SELECT c.code_value_name FROM sys_code_values_v c where c.code='DATA_CLASSIFICATION' and c.code_value = t1.archive_type) archive_type_desc,
                       (SELECT c.code_value_name FROM sys_code_values_v c where c.code='YES_NO' and c.code_value = 'Y') suppl_trans_flag,
                        (SELECT c.code_value_name FROM sys_code_values_v c where c.code='POST_STATUS_DESC' and c.code_value =t1.post_status) post_status_desc,
                        t1.hly_req_number as post_batch_num,
                       t1.post_message
                  FROM hl_e_archives_pool t1
				  #WHERE_CLAUSE#
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
    		 	begin
   				   elec_wfl_pkg.doc_import_return(
   				   								 p_primary_field      =>${@primary_field},
                                                 p_post_status        =>${@post_status},
                                                 p_post_message       =>${@post_message},
                                                 p_hly_req_number     =>${@hly_req_number},
                                                 p_user_id            => ${/session/@user_id});

   			   end;
    		 ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
    		 	begin
   				   elec_wfl_pkg.elec_type_update(
   				   								p_sql_type            => 'UPDATE',
                                                p_base_archive_id     => ${@base_archive_id},
                                                p_base_archive_code   => ${@base_archive_code},
                                                p_archive_type        => ${@archive_type},
                                                p_post_stru_data_flag => ${@post_stru_data_flag},
                                                p_stru_data_sql       => ${@stru_data_sql},
                                                p_is_workflow         => ${@is_workflow},
                                                p_workflow_id         => ${@workflow_id},
                                                p_post_atm_flag       => ${@post_atm_flag},
                                                p_atm_sql             => ${@atm_sql},
                                                p_je_check_flag       => ${@je_check_flag},
                                                p_je_source_sql       => ${@je_source_sql},
                                                p_user_id             => ${/session/@user_id});
   			   end;
    		 ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
    		 	begin
   				   elec_wfl_pkg.elec_type_delete(
                                                p_base_archive_id     => ${@base_archive_id},
                                                p_user_id             => ${/session/@user_id});
   			   end;
    		 ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field  name="internal_period_num" queryExpression="t1.internal_period_num =${@internal_period_num}"/>
        <bm:query-field  name="archive_type_desc" queryExpression="t1.archive_type_desc =${@archive_type_desc}"/>
        <bm:query-field  name="primary_field" queryExpression="t1.primary_field =${@primary_field}"/>
        <bm:query-field  name="document_info" queryExpression="t1.document_info like ${@document_info}"/>
        <bm:query-field  name="post_status_desc" queryExpression="t1.post_status_desc =${@post_status_desc}"/>
        <bm:query-field  name="post_batch_num" queryExpression="t1.post_batch_num =${@post_batch_num}"/>
        <bm:query-field  name="suppl_trans_flag" queryExpression="t1.suppl_trans_flag =${@suppl_trans_flag}"/>
    </bm:query-fields>
</bm:model>
