<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: WHT  
    $Date: 2011-6-15 下午04:52:22  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="ZJ_WFL_WORKFLOW_NODE_BRCH_PARA">
    <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_id"/>
        <bm:field name="procedure_id"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            	select t1.procedure_para_id,
            		   ${@node_id} as node_id,
            		   ${@procedure_id} as procedure_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_brch_para p
				 where t1.procedure_id = ${@procedure_id}
				   and p.node_id(+) = ${@node_id}
				   and p.procedure_para_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_branch_para
				(
					p_node_id       		  => ${@node_id},
					p_procedure_id            => ${@procedure_id},
					p_procedure_para_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>
