<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-5-20 下午5:59:30  
    $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 zr.instance_id, 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 = 15 --节点序号
           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.workflow_code='PROJECT_REPORT_WORK_FLOW_RISK'--资产管理部code
                                  and hv1.node_sequence_num = 15 --节点序号
                               )),'N') project_review_post, --资产管理部评审-资产管理部出具意见                        
       zr.user_id,
       p.lease_organization,
       ev.user_desc user_desc2
  from Prj_Project p, zj_wfl_approve_record zr, exp_emp_user_e_v 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 = 15 --节点序号
           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.workflow_code='PROJECT_REPORT_WORK_FLOW_RISK'--资产管理部code
                                  and hv1.node_sequence_num = 15 --节点序号
                               ))
   and zr.user_id = ev.user_id
   and p.project_id=${/parameter/@project_id}
   ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
