<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: WHT  
    $Date: 2011-7-28 上午09:51:47  
    $Revision: 1.0  
    $Purpose: 
-->
<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_NODE_NOTICE">
    <bm:fields>
        <bm:field name="node_notice_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NODE_NOTICE_ID" prompt="ZJ_WFL_WORKFLOW_NODE_NOTICE.NODE_NOTICE_ID"/>
        <bm:field name="node_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NODE_ID" prompt="ZJ_WFL_WORKFLOW_NODE_NOTICE.NODE_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="ZJ_WFL_WORKFLOW_NODE_NOTICE.COMPANY_ID"/>
        <bm:field name="user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="USER_ID" prompt="ZJ_WFL_WORKFLOW_NODE_NOTICE.USER_ID"/>
        <bm:field name="user_name" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" physicalName="USER_NAME"/>
        <bm:field name="user_desc" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false" physicalName="EMPLOYEE_NAME"/>
        <bm:field name="notify_template_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NOTIFY_TEMPLATE_ID" prompt="ZJ_WFL_WORKFLOW_NODE_NOTICE.NOTIFY_TEMPLATE_ID"/>
        <bm:field name="notify_template_code" databaseType="VARHCAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="notify_template_desc" databaseType="VARCHAR2" datatype="java.lang.String" forInsert="false" forUpdate="false"/>
        <bm:field name="notifier_permission" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.node_notice_id,
				       (select count(1)||'条规则'
				          from zj_wfl_business_rule_assigns a
				         where a.assign_rule_id = t1.node_notice_id
				           and a.assign_rule_type = 'NOTIFIER') as notifier_permission,
				       t1.node_id,
				       t1.company_id,
				       t1.user_id,
				       v.user_name,
				       v.description as user_desc,
				       t1.notify_template_id,
				       nt.notify_template_code,
				       nt.description as notify_template_desc
				  from zj_wfl_workflow_node_notice t1
				 inner join sys_user v
				    on v.user_id = t1.user_id
				 inner join zj_sys_notify_template_v nt
				    on nt.notify_template_id = t1.notify_template_id
    			#WHERE_CLAUSE#
    			order by t1.company_id,t1.node_id,t1.user_id
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field field="node_id" queryOperator="="/>
        <bm:query-field field="company_id" queryExpression="((t1.company_id = ${@company_id}) or (select n.system_maintain_flag from zj_wfl_workflow_node n where n.node_id = t1.node_id) = &apos;Y&apos;)"/>
    </bm:query-fields>
    <bm:primary-key>
        <bm:pk-field name="node_notice_id"/>
    </bm:primary-key>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
</bm:model>
