<?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
                    TO_CHAR(creation_date,'yyyy')=TO_CHAR(sysdate,'yyyy') and t.data_class='NORMAL' and t.Overdue_Status='Y' and t.contract_status not in ('NEW','SIGN_APPROVING','INCEPT')) other_count,
        (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                    TO_CHAR(creation_date,'yyyy')=TO_CHAR(sysdate,'yyyy') and t.contract_status='NEW' and t.data_class='NORMAL') new_count,
                    (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                    TO_CHAR(creation_date,'yyyy')=TO_CHAR(sysdate,'yyyy') and t.contract_status='SIGN_APPROVING' and t.data_class='NORMAL') sign_count,
             (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                    TO_CHAR(creation_date,'yyyy')=TO_CHAR(sysdate,'yyyy') and t.contract_status='INCEPT' and t.data_class='NORMAL') incept_count,
                    (SELECT
                    COUNT(*) 
                FROM
                    con_contract t
                WHERE
                    TO_CHAR(creation_date,'yyyy')=TO_CHAR(sysdate,'yyyy') and t.Overdue_Status='Y' and t.data_class='NORMAL') 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>
