<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="node_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="parent_node_id" databaseType="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="sequence_num" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="150" forDisplay="true" prompt="节点序号"/>
        <bm:field name="node_desc" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="250" forDisplay="true" forQuery="true" prompt="节点名称"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
        		select * from 
        		(
        		select a.node_id,
				       null as parent_node_id,
				       to_char(a.sequence_num) as sequence_num,
				       node_desc
				  from zj_wfl_workflow_node a
				 where a.workflow_id = ${@workflow_id}
				   and a.node_type != 'SUB_PROCESS'
				union all
				select a.node_id,
				       p.parent_node_id,
				       p.sequence_num || '-' || a.sequence_num,
				       p.node_desc || '-' || a.node_desc
				  from zj_wfl_workflow_node a,
				       (select a.link_workflow_id,
				               a.node_id as parent_node_id,
				               a.sequence_num,
				               a.node_desc
				          from zj_wfl_workflow_node a
				         where a.workflow_id = ${@workflow_id}
				           and a.node_type = 'SUB_PROCESS') p
				 where a.workflow_id = p.link_workflow_id
				 )
				 #WHERE_CLAUSE#
				 order by sequence_num
        	]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
            	begin
				  zj_wfl_core_pkg.admin_workflow_jump(p_instance_id 		=> ${@instance_id},
				                                      p_to_node_id 			=> ${@node_id},
				                                      p_to_parent_node_id 	=> ${@parent_node_id},
				                                      p_user_id 			=> ${/session/@user_id});
				end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="node_desc" queryExpression="node_desc like ${@node_desc}"/>
    </bm:query-fields>
</bm:model>
