<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: liuguocai  
    $Date: 2015-12-15 上午11:10:48  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" needAccessControl="false">
    <bm:fields>
        <bm:field name="agree_perecent"/>
        <bm:field name="refuse_perecent"/>
        <bm:field name="agree_name"/>
        <bm:field name="refuse_name"/>
        <bm:field name="discuss_perecent"/>
        <bm:field name="leave_perecent"/>
        <bm:field name="discuss_name"/>
        <bm:field name="leave_name"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT ((SELECT COUNT(1)
           FROM hn_doc_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'agree') || '/' ||
       (SELECT COUNT(1)
           FROM hn_doc_approver t1
          WHERE t1.approval_id = ${@approval_id})) agree_perecent,
       ((SELECT COUNT(1)
           FROM hn_doc_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'refuse') || '/' ||
       (SELECT COUNT(1)
           FROM hn_doc_approver t1
          WHERE t1.approval_id = ${@approval_id})) refuse_perecent,
       ((SELECT COUNT(1)
           FROM hn_doc_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'discuss') || '/' ||
       (SELECT COUNT(1)
           FROM hn_doc_approver t1
          WHERE t1.approval_id = ${@approval_id})) discuss_perecent,
       ((SELECT COUNT(1)
           FROM hn_doc_approver t1
          WHERE t1.approval_id = ${@approval_id}
            AND t1.approve_status = 'leave') || '/' ||
       (SELECT COUNT(1)
           FROM hn_doc_approver t1
          WHERE t1.approval_id = ${@approval_id})) leave_perecent,
       hn_doc_meeting_pkg.get_approver_name(${@approval_id},
                                                       'agree') agree_name,
       hn_doc_meeting_pkg.get_approver_name(${@approval_id},
                                                       'refuse') refuse_name,
       hn_doc_meeting_pkg.get_approver_name(${@approval_id},
                                                       'discuss') discuss_name,
       hn_doc_meeting_pkg.get_approver_name(${@approval_id},
                                                       'leave') leave_name
  FROM dual
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
