<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:e="leaf.service.exception" xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="ZJ_WFL_WORKFLOW_ASSIGNS">
    <bm:fields>
        <bm:field name="assign_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ASSIGN_ID" prompt="ZJ_WFL_WORKFLOW_ASSIGNS.ASSIGN_ID"/>
        <bm:field name="workflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WORKFLOW_ID" prompt="ZJ_WFL_WORKFLOW_ASSIGNS.WORKFLOW_ID"/>
        <bm:field name="workflow_code" forInsert="false" forUpdate="false"/>
        <bm:field name="workflow_desc" forInsert="false" forUpdate="false"/>
        <bm:field name="workflow_type_id" forInsert="false" forUpdate="false"/>
        <bm:field name="workflow_type_code" forInsert="false" forUpdate="false"/>
        <bm:field name="workflow_type_desc" forInsert="false" forUpdate="false"/>
        <bm:field name="sub_category" forInsert="false" forUpdate="false"/>
        <bm:field name="sub_category_desc" forInsert="false" forUpdate="false"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="ZJ_WFL_WORKFLOW_ASSIGNS.COMPANY_ID"/>
        <bm:field name="company_code" forInsert="false" forUpdate="false"/>
        <bm:field name="company_name" forInsert="false" forUpdate="false"/>
        <bm:field name="serial_number" databaseType="NUMBER" datatype="java.lang.Long" forInsert="false" forUpdate="false" physicalName="SERIAL_NUMBER" prompt="序号"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="ZJ_WFL_WORKFLOW_ASSIGNS.ENABLED_FLAG"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.assign_id,
				       t1.workflow_id,
				       w.workflow_code,
				       w.workflow_desc,
				       w.workflow_type_id,
				       w.workflow_type_code,
				       w.workflow_type_desc,
				       w.sub_category,
				       w.sub_category_desc,
				       t1.company_id,
				       c.company_code,
				       c.company_short_name as company_name,
				       t1.enabled_flag,
				       w.serial_number
				  from zj_wfl_workflow_assigns t1
				 inner join zj_wfl_workflow_v w
				    on w.workflow_id = t1.workflow_id
				 inner join zj_wfl_workflow_companies_vl c
				    on c.company_id = t1.company_id
				#WHERE_CLAUSE#
				order by w.serial_number,w.workflow_type_code,w.workflow_code
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="assign_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="workflow_id" queryExpression="t1.workflow_id = ${/parameter/@workflow_id}"/>
    </bm:query-fields>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="公司代码${@company_code}已经存在!"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
