<?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
                        hls_division h,
                        prj_project p
                    WHERE
                        h.division     =p.division AND
                        h.description  ='二手车' AND
                        
                        
                        TO_CHAR(p.creation_date, 'yyyy') = TO_CHAR(sysdate, 'yyyy')
                    ) old_count,
                    (SELECT
                        COUNT(*)
                    FROM
                        hls_division h,
                        prj_project p
                    WHERE
                        h.division     =p.division AND
                        h.description  ='新车' AND
                        
                        
                        TO_CHAR(p.creation_date, 'yyyy') = TO_CHAR(sysdate, 'yyyy')
                    ) new_count,
                    (SELECT
                        COUNT(*)
                    FROM
                        hls_division h,
                        prj_project p
                    WHERE
                        h.division     =p.division AND
                        h.description  ='节能环保' AND
                        
                        
                        TO_CHAR(p.creation_date, 'yyyy') = TO_CHAR(sysdate, 'yyyy')
                    ) protection_count,
                    (SELECT
                        COUNT(*)
                    FROM
                        hls_division h,
                        prj_project p
                    WHERE
                        h.division     =p.division AND
                        h.description  ='公共建设' AND
                        
                        
                        TO_CHAR(p.creation_date, 'yyyy') = TO_CHAR(sysdate, 'yyyy')
                    ) public_count,
                    (SELECT
                        COUNT(*)
                    FROM
                        hls_division h,
                        prj_project p
                    WHERE
                        h.division     =p.division AND
                        h.description  ='其它' AND
                        
                        
                        TO_CHAR(p.creation_date, 'yyyy') = TO_CHAR(sysdate, 'yyyy')
                    ) other_count
                FROM
                    dual
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="old_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OLD_COUNT"/>
        <bm:field name="new_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NEW_COUNT"/>
        <bm:field name="protection_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROTECTION_COUNT"/>
        <bm:field name="public_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PUBLIC_COUNT"/>
        <bm:field name="other_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_COUNT"/>
    </bm:fields>
</bm:model>
