<?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_BUSINESS_RULES" defaultOrderBy="business_rule_code">
    <bm:fields>
        <bm:field name="business_rule_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BUSINESS_RULE_ID"/>
        <bm:field name="business_rule_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_RULE_CODE" prompt="业务规则代码"/>
        <bm:field name="description_id" databaseType="NUMBER" datatype="java.lang.Long" multiLanguage="true" multiLanguageDescField="description" physicalName="DESCRIPTION_ID" prompt="描述"/>
        <bm:field name="description" databaseType="VARCHAR" datatype="java.lang.String" forInsert="false" forUpdate="false" prompt="描述"/>
        <bm:field name="workflow_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WORKFLOW_CATEGORY" prompt="工作流类型代码"/>
        <bm:field name="workflow_category_desc" databaseType="VARCHAR" datatype="java.lang.String" forInsert="false" forUpdate="false" prompt="工作流类型"/>
        <bm:field name="start_date" databaseType="DATE" datatype="java.util.Date" forUpdate="true" physicalName="START_DATE" prompt="有效日期从"/>
        <bm:field name="end_date" databaseType="DATE" datatype="java.util.Date" forUpdate="true" physicalName="END_DATE" prompt="有效日期到"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.business_rule_id,
				       t1.business_rule_code,
				       t1.description_id,
				       t1.description,
				       t1.workflow_category,
				       t1.workflow_category_desc,
				       t1.start_date,
				       t1.end_date
				  from zj_wfl_business_rules_v t1
				  #WHERE_CLAUSE#
				 order by t1.business_rule_code
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
        <f:multi-language-storage/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="business_rule_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="bussiness_rule_code_from" queryExpression="t1.business_rule_code &gt;=${@bussiness_rule_code_from}"/>
        <bm:query-field name="bussiness_rule_code_to" queryExpression="t1.business_rule_code &lt;=${@bussiness_rule_code_to}"/>
        <bm:query-field name="workflow_category_from" queryExpression="t1.workflow_category &gt;= ${@workflow_category_from}"/>
        <bm:query-field name="workflow_category_to" queryExpression="t1.workflow_category &lt;= ${@workflow_category_to}"/>
        <bm:query-field field="business_rule_id" queryOperator="="/>
        <bm:query-field field="description" queryOperator="like"/>
        <bm:query-field field="business_rule_code" queryOperator="like"/>
        <bm:query-field field="workflow_category" queryOperator="like"/>
        <bm:query-field name="workflow_id" expression="exists (select 1 from ZJ_WFL_WORKFLOW_TYPE w,zj_wfl_workflow z where z.workflow_id=${@workflow_id} and w.workflow_type_id=z.workflow_type_id and w.workflow_type_code=t1.workflow_category)"/>
    </bm:query-fields>
    <e:exception-descriptor-config>
        <e:exception-descriptor exception="java.sql.SQLException" handleClass="leaf.database.SQLExceptionDescriptor">
            <e:error-message code="1" message="工作流权限规则代码重复,请重新输入"/>
        </e:exception-descriptor>
    </e:exception-descriptor-config>
</bm:model>
