<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    DECODE(SUBSTR(province_id_n, 1, 2), '内蒙', '内蒙古', '黑龙', '黑龙江', SUBSTR(province_id_n, 1, 2)) province_id_n,
                    ROUND(sum_amount/10000,2) sum_amount,
                    sum_count
                FROM
                    (SELECT DISTINCT
                        cc.province_n AS province_id_n,
                        (SELECT
                            SUM(t.FINANCE_AMOUNT)
                        FROM
                            CON_CONTRACT_CAL_EASY_LV t
                        WHERE
                            t.province_n  = cc.province_n
                        ) sum_amount,
                        (SELECT
                            COUNT(1)
                        FROM
                            CON_CONTRACT_CAL_EASY_LV t
                        WHERE
                            t.province_n = cc.province_n
                        ) sum_count
                    FROM
                        CON_CONTRACT_CAL_EASY_LV cc
                    ) t1
                WHERE
                    t1.sum_count > 0
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
