<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hty
    $Date: 2018/5/18 10:15
    $Revision: 1.0 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                   SELECT
                      stock_contract_count,
                      new_contract_count
                    FROM
                      (
                        SELECT COUNT(*) AS stock_contract_count
                        FROM
                          con_contract c
                        WHERE
                          c.contract_status NOT IN (
                            'CANCEL',
                            'HISTORY',
                            'REJECT'
                          )
                          AND c.CREATION_DATE < (trunc(sysdate) - to_char(sysdate,'dd') + 1)
                      ) stock_contract_count,
                      (
                        SELECT COUNT(*) AS new_contract_count
                        FROM
                          con_contract c
                        WHERE
                          c.contract_status NOT IN (
                            'CANCEL',
                            'HISTORY',
                            'REJECT'
                          )
                          AND c.CREATION_DATE >= (trunc(sysdate) - to_char(sysdate,'dd') + 1)
                      ) new_contract_count
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="stock_contract_count" databaseType="NUMBER" datatype="java.lang.Long" forDisplay="true" forQuery="true" physicalName="stock_contract_count" prompt="员工号"/>
        <bm:field name="new_contract_count" databaseType="NUMBER" datatype="java.lang.Long" forDisplay="true" forQuery="true" physicalName="new_contract_count" prompt="员工号"/>
    </bm:fields>
</bm:model>
