<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:e="leaf.service.exception" xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="ZJ_WFL_WORKFLOW_NODE_PROCEDURE">
    <bm:fields>
        <bm:field name="node_procedure_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NODE_PROCEDURE_ID" prompt="ZJ_WFL_WORKFLOW_NODE_PROCEDURE.NODE_PROCEDURE_ID"/>
        <bm:field name="node_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NODE_ID" prompt="ZJ_WFL_WORKFLOW_NODE_PROCEDURE.NODE_ID"/>
        <bm:field name="sequence_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEQUENCE_NUM" prompt="ZJ_WFL_WORKFLOW_NODE_PROCEDURE.SEQUENCE_NUM"/>
        <bm:field name="procedure_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROCEDURE_ID" prompt="ZJ_WFL_WORKFLOW_NODE_PROCEDURE.PROCEDURE_ID"/>
        <bm:field name="exec_procedure" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="procedure_code" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="procedure_desc" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.node_procedure_id,
				       t1.node_id,
				       t1.sequence_num,
				       t1.procedure_id,
				       p.exec_procedure,
				       p.procedure_code,
				       p.procedure_desc
				  from zj_wfl_workflow_node_procedure t1, zj_wfl_workflow_procedure p
				 #WHERE_CLAUSE#
				 order by t1.sequence_num
				  
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
            begin
				zj_wfl_workflow_pkg.delete_wfl_node_procedure
				(
					p_node_procedure_id       => ${@node_procedure_id},					
					p_user_id                 => ${/session/@user_id}
				);
			end;
			]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.node_id = ${@node_id}"/>
        <bm:data-filter enforceOperations="query" expression="p.procedure_id(+) = t1.procedure_id"/>
    </bm:data-filters>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk sequenceName="zj_wfl_workflow_node_proc_s"/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="node_procedure_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="node_procedure_id" queryOperator="="/>
    </bm:query-fields>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="节点序号${@sequence_num}已经存在!"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
