<?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" alias="t1" baseTable="ZJ_WFL_WORKFLOW_END_PROCEDURE" defaultOrderBy="sequence_num">
    <bm:fields>
        <bm:field name="workflow_procedure_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WORKFLOW_PROCEDURE_ID" prompt="ZJ_WFL_WORKFLOW_END_PROCEDURE.WORKFLOW_PROCEDURE_ID"/>
        <bm:field name="workflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WORKFLOW_ID" prompt="ZJ_WFL_WORKFLOW_END_PROCEDURE.WORKFLOW_ID"/>
        <bm:field name="sequence_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEQUENCE_NUM" prompt="ZJ_WFL_WORKFLOW_END_PROCEDURE.SEQUENCE_NUM"/>
        <bm:field name="workflow_status" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WORKFLOW_STATUS" prompt="ZJ_WFL_WORKFLOW_END_PROCEDURE.WORKFLOW_STATUS"/>
        <bm:field name="procedure_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROCEDURE_ID" prompt="ZJ_WFL_WORKFLOW_END_PROCEDURE.PROCEDURE_ID"/>
        <bm:field name="procedure_code" datatype="java.lang.String" expression="(select z.procedure_code procedure_code from ZJ_WFL_WORKFLOW_PROCEDURE z where z.procedure_id=t1.procedure_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="procedure_desc" datatype="java.lang.String" expression="(select z.procedure_desc procedure_desc  from ZJ_WFL_WORKFLOW_PROCEDURE z where z.procedure_id=t1.procedure_id)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk autoReturn="true" sequenceName="ZJ_WFL_END_PROCEDURE_S"/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="workflow_procedure_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="workflow_id" queryExpression="t1.workflow_id = ${@workflow_id}"/>
    </bm:query-fields>
    <bm:operations>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            begin
				zj_wfl_workflow_pkg.delete_wfl_end_procedure_para(p_workflow_procedure_id	=> ${@workflow_procedure_id});
				
				zj_wfl_workflow_pkg.update_zj_wfl_end_procedure(p_workflow_procedure_id  =>${@workflow_procedure_id},
						                                        p_workflow_id            =>${@workflow_id},
						                                        p_sequence_num           =>${@sequence_num},
						                                        p_workflow_status        =>${@workflow_status},
						                                        p_procedure_id           =>${@procedure_id});
			end; 
			]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
            begin
            
				zj_wfl_workflow_pkg.delete_wfl_end_procedure_para(p_workflow_procedure_id	=> ${@workflow_procedure_id});
				
                zj_wfl_workflow_pkg.delete_zj_wfl_end_procedure(p_workflow_procedure_id       => ${@workflow_procedure_id});
			end; 
			]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
