<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="id" datatype="java.lang.Long" physicalName="WORKFLOW_TYPE_PARA_ID"/>
        <bm:field name="code" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="PARAMETER_CODE" prompt="参数代码"/>
        <bm:field name="description" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="PARAMETER_DESC" prompt="参数描述"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select * from (
            	
            select a.node_id id,
               null as parent_node_id,
               to_char(a.sequence_num) as code,
               decode(length(a.sequence_num),
                      2,
                      '00' || a.sequence_num,
                      3,
                      '0'||a.sequence_num,
                      a.sequence_num) sequence_num_desc,
               node_desc description,
               a.workflow_id
          from zj_wfl_workflow_node a
         where  a.node_type != 'SUB_PROCESS'
        union all
        select a.node_id,
               p.parent_node_id,
               p.sequence_num || '-' || a.sequence_num,
               decode(length(p.sequence_num),
                      2,
                      '00' || p.sequence_num,
                      3,
                      '0'||p.sequence_num,
                      p.sequence_num) sequence_num_desc,
               p.node_desc || '-' || a.node_desc,
               p.workflow_id
          from zj_wfl_workflow_node a,
               (select a.link_workflow_id,
                       a.node_id as parent_node_id,
                       a.sequence_num,
                       a.node_desc,
                       a.workflow_id
                  from zj_wfl_workflow_node a
                 where  a.node_type = 'SUB_PROCESS') p
         where a.workflow_id = p.link_workflow_id
         ) t1 
				 #WHERE_CLAUSE# 
				 order by t1.sequence_num_desc ,t1.code
		    ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="code" queryExpression="t1.code like ${@code}"/>
        <bm:query-field name="description" queryExpression="t1.description like ${@description}"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.workflow_id = ${/parameter/@workflow_id}"/>
    </bm:data-filters>
</bm:model>
