<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features">
    <bm:fields>
        <bm:field name="procedure_para_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROCEDURE_PARA_ID"/>
        <bm:field name="sequence_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEQUENCE_NUM"/>
        <bm:field name="parameter_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARAMETER_CODE"/>
        <bm:field name="parameter_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARAMETER_DESC"/>
        <bm:field name="parameter_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARAMETER_TYPE"/>
        <bm:field name="parameter_value" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARAMETER_VALUE"/>
        <bm:field name="parameter_value_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PARAMETER_VALUE_DESC"/>
        <bm:field name="node_action_id"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            	select t1.procedure_para_id,
            		   ${@node_action_id} as node_action_id,
            		   t1.sequence_num,
				       t1.parameter_code,
				       t1.parameter_desc,
				       p.parameter_type,
				       p.parameter_value,
				       decode(p.parameter_type,
				              'DEFAULT',
				              p.parameter_value,
				              'WFL_INSTANCE_PARA',
				              (select v.code_value_name
				                 from sys_code_values_v v
				                where v.code_value = p.parameter_value
				                  and v.code = 'ZJ_WFL_INSTANCE_PARA_VALUES'),
				              'WFL_TYPE_PARA',
				              (select tp.parameter_desc
				                 from zj_wfl_workflow_type_parameter tp
				                where tp.workflow_type_para_id = p.parameter_value),
				              null) parameter_value_desc
				  from zj_wfl_workflow_procedure_para t1,
				       zj_wfl_workflow_node_act_para p
				 where t1.procedure_id = ${@procedure_id}
				   and p.node_action_id(+) = ${@node_action_id}
				   and p.parameter_id(+) = t1.procedure_para_id
				 order by t1.sequence_num
		    ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            begin
				zj_wfl_workflow_pkg.save_wfl_node_action_para
				(
					p_node_action_id          => ${@node_action_id},
					p_parameter_id            => ${@procedure_para_id},
					p_parameter_type          => ${@parameter_type},
					p_parameter_value         => ${@parameter_value},
					p_user_id                 => ${/session/@user_id}
				);
			end;
			]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
