<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-5-20 下午5:53:00  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[select p.project_id,
       p.chance_id,
       nvl((select nvl(hv.comment_text,hv.action_type_desc)
             from zj_wfl_workflow_instance wi, zj_wfl_approve_history_v hv
            where wi.instance_id = p.wfl_instance_id
              and wi.instance_id = hv.instance_id
              and hv.node_sequence_num = 30 --节点序号
              and hv.record_id = (select max(hv1.record_id)
                                    from zj_wfl_workflow_instance wi1,
                                         zj_wfl_approve_history_v hv1
                                   where wi1.instance_id = p.wfl_instance_id
                                     and wi1.instance_id = hv1.instance_id
                                     and hv1.node_sequence_num = 30 --节点序号
                                     and hv1.workflow_code =
                                         'PROJECT_REPORT_WORK_FLOW_CAPITAL' --融资部code
                                  )),
           'N') project_review_post, --项目评审岗       
       zr.user_id,
       p.lease_organization,
       ev.description user_desc2
  from Prj_Project p, zj_wfl_approve_record zr, sys_user ev
 where zr.record_id =
       (select hv.record_id
          from zj_wfl_workflow_instance wi, zj_wfl_approve_history_v hv
         where wi.instance_id = p.wfl_instance_id
           and wi.instance_id = hv.instance_id
           and hv.node_sequence_num = 30 --节点序号
           and hv.record_id =
               (select max(hv1.record_id)
                  from zj_wfl_workflow_instance wi1,
                       zj_wfl_approve_history_v hv1
                 where wi1.instance_id = p.wfl_instance_id
                   and wi1.instance_id = hv1.instance_id
                   and hv1.node_sequence_num = 30 --节点序号
                   and hv1.workflow_code = 'PROJECT_REPORT_WORK_FLOW_CAPITAL' --融资部code
                ))
   and zr.user_id = ev.user_id
   and p.project_id = ${/parameter/@project_id}
   ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
