<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-7-13 下午1:46:26  
    $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 = hd.wfl_instance_id
           and wi.instance_id = hv.instance_id
           and hv.node_sequence_num = 140 --节点序号
           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 = hd.wfl_instance_id
                                  and wi1.instance_id = hv1.instance_id
                                  and hv1.node_sequence_num = 140 --节点序号
                               )) business_department_head,--总裁审批意见
       zr.user_id,
       ev.user_desc
  from csh_payment_req_hd hd, 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 = hd.wfl_instance_id
           and wi.instance_id = hv.instance_id
           and hv.node_sequence_num = 140 --节点序号
           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 = hd.wfl_instance_id
                                  and wi1.instance_id = hv1.instance_id
                                  and hv1.node_sequence_num = 140 --节点序号
                               ))
   and zr.user_id = ev.user_id
   and hd.payment_req_id=${/parameter/@payment_req_id}
   ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
