<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-11-10 上午10:54:07  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    T1.*
                FROM
                    (SELECT
                        a.user_id,
                        a.user_name,
                        a.description
                    FROM
                        sys_user a
                    WHERE
                        EXISTS
                        (SELECT
                            1
                        FROM
                            sdic_workflow_assigned sw
                        WHERE
                            sw.user_id     =a.user_id AND
                            sw.instance_id =${@instance_id} AND
                            sw.sequence_num=${@sequence_num}
                        )
                    ) T1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:parameters>
                <bm:parameter name="return_number" input="false" output="true" outputPath="@return_number"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
          begin
            sdic_workflow_assign_pkg.workflow_user_assign(
                                 p_instance_id    =>${@instance_id},
                                 p_sequence_num   =>${@sequence_num},
                                 p_assign_user_id =>${@assign_user_id},
                                 p_user_id        =>${/session/@user_id},
                                 p_batch_id =>${@batch_id},
                                 p_return_number  =>${@return_number},
                                 p_comment_text => ${@comment_text});
          end;
          ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:parameters>
                <bm:parameter name="return_number" input="false" output="true" outputPath="@return_number"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
           begin
              sdic_workflow_assign_pkg.submit_button_action(
              p_instance_id => ${@instance_id},
               p_user_id =>${/session/@user_id} ,
                p_return_number =>${@return_number},
                p_comment_text => ${@comment_text} );
           end;
           ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="user_name" queryExpression="T1.user_name LIKE ${@user_name}"/>
        <bm:query-field name="description" queryExpression="T1.description LIKE ${@description}"/>
    </bm:query-fields>
</bm:model>
