<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-11-21 下午05:31:23  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.count_num,
                    t1.description,
                    t1.user_name,
                    t1.user_id
                FROM
                    (SELECT
                        COUNT(1) count_num,
                        su.user_name,
                        su.description,
                        su.user_id
                    FROM
                        zj_wfl_instance_node_recipient a,
                        ZJ_WFL_WORKFLOW_NODE b,
                        zj_wfl_workflow c,
                        zj_wfl_workflow_instance zi,
                        sys_user su
                    WHERE
                        a.node_id       = b.node_id AND
                        b.workflow_id   = c.workflow_id AND
                        c.workflow_code = 'WFL_PRJ' AND
                        su.user_id      = a.user_id AND
                        b.sequence_num in (10,15,20) and
                        zi.instance_id =  a.instance_id
                    GROUP BY
                        su.user_name,
                        su.description,
                        su.user_id
                    ) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="user_id" queryExpression="t1.user_id like ${@user_id}"/>
        <bm:query-field name="project_number" queryExpression="exists (select 1 from zj_wfl_instance_node_recipient w,prj_project pp where w.instance_id = pp.wfl_instance_id and w.user_id = t1.user_id and pp.project_number = ${@project_number})"/>
        <bm:query-field name="bp_name" queryExpression="exists (select 1 from zj_wfl_instance_node_recipient w,prj_project pp,hls_bp_master hm where w.instance_id = pp.wfl_instance_id and w.user_id = t1.user_id and hm.bp_id=pp.bp_id_tenant and hm.bp_name like ${@bp_name})"/>
    </bm:query-fields>
</bm:model>
