<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-4-27 上午10:52:06  
    $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 (select hv.comment_text
          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 = 40 --节点序号
                               )) project_review_post,--项目评审岗意见
                               
       zr.user_id,
       p.lease_organization,
       ('' ||'(' ||ev.user_desc||')') user_desc2
  from prj_chance 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 = 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 = 40 --节点序号
                               ))
   and zr.user_id = ev.user_id
   and p.chance_id=${/parameter/@chance_id}
  

 
 ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <!--  <bm:query-fields>
        <bm:query-field name="chance_id" queryExpression="chance_id=${@chance_id}"/>
    </bm:query-fields> -->
</bm:model>
