main_contract_chart.lwm 4.55 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: 王建文  
    $Date: 2017-3-6 下午7:49:17  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                 select (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                      t.data_class='NORMAL' and exists (select 1 from aut_trx_user_authorize a1,aut_owner_user_authorize a2 where a1.trx_category = 'CONTRACT' 
            and a1.trx_id = t.contract_id  
            and trunc(sysdate) between a1.start_date and nvl(a1.end_date,trunc(sysdate)) 
            and a1.user_id = a2.owner_user_id 
            and a1.trx_category = a2.trx_category  
            and a2.authorized_user_id = ${@user_id} 
            and trunc(sysdate) between a2.start_date and nvl(a2.end_date,trunc(sysdate))) and t.Overdue_Status!='Y' and t.contract_status not in ('NEW','SIGN_APPROVING','INCEPT')) other_count,
        (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                     t.contract_status='NEW' and  t.data_class='NORMAL' and exists (select 1 from aut_trx_user_authorize a1,aut_owner_user_authorize a2 where a1.trx_category = 'CONTRACT' 
            and a1.trx_id = t.contract_id  
            and trunc(sysdate) between a1.start_date and nvl(a1.end_date,trunc(sysdate)) 
            and a1.user_id = a2.owner_user_id 
            and a1.trx_category = a2.trx_category  
            and a2.authorized_user_id = ${@user_id} 
            and trunc(sysdate) between a2.start_date and nvl(a2.end_date,trunc(sysdate)))) new_count,
          (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                     t.contract_status='SIGN_APPROVING' and t.data_class='NORMAL' and exists (select 1 from aut_trx_user_authorize a1,aut_owner_user_authorize a2 where a1.trx_category = 'CONTRACT' 
            and a1.trx_id = t.contract_id  
            and trunc(sysdate) between a1.start_date and nvl(a1.end_date,trunc(sysdate)) 
            and a1.user_id = a2.owner_user_id 
            and a1.trx_category = a2.trx_category  
            and a2.authorized_user_id = ${@user_id} 
            and trunc(sysdate) between a2.start_date and nvl(a2.end_date,trunc(sysdate)))) sign_count,
           (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                     t.contract_status='INCEPT' and t.data_class='NORMAL' and exists (select 1 from aut_trx_user_authorize a1,aut_owner_user_authorize a2 where a1.trx_category = 'CONTRACT' 
            and a1.trx_id = t.contract_id  
            and trunc(sysdate) between a1.start_date and nvl(a1.end_date,trunc(sysdate)) 
            and a1.user_id = a2.owner_user_id 
            and a1.trx_category = a2.trx_category  
            and a2.authorized_user_id = ${@user_id} 
            and trunc(sysdate) between a2.start_date and nvl(a2.end_date,trunc(sysdate)))) incept_count,
           (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                     t.Overdue_Status='Y' and t.data_class='NORMAL' and exists (select 1 from aut_trx_user_authorize a1,aut_owner_user_authorize a2 where a1.trx_category = 'CONTRACT' 
            and a1.trx_id = t.contract_id  
            and trunc(sysdate) between a1.start_date and nvl(a1.end_date,trunc(sysdate)) 
            and a1.user_id = a2.owner_user_id 
            and a1.trx_category = a2.trx_category  
            and a2.authorized_user_id = ${@user_id} 
            and trunc(sysdate) between a2.start_date and nvl(a2.end_date,trunc(sysdate)))) overdue_count       
                    from dual
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="other_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_COUNT"/>
        <bm:field name="new_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NEW_COUNT"/>
        <bm:field name="sign_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SIGN_COUNT"/>
        <bm:field name="incept_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INCEPT_COUNT"/>
        <bm:field name="overdue_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OVERDUE_COUNT"/>
    </bm:fields>
</bm:model>