<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.unis.emergencySupport.modular.es.mapper.EsDeliveryEnterpriseMapper">
    <select id="selectProvinceCount"
            resultType="com.unis.emergencySupport.modular.es.entity.vo.EsDeliveryEnterpriseCountVO">
        SELECT
            management_area_province area,
            COUNT(*) AS  enterpriseCount
        FROM
            biz_es_delivery_enterprise
        GROUP BY
            management_area_province
    </select>
    <select id="selectCityCount"
            resultType="com.unis.emergencySupport.modular.es.entity.vo.EsDeliveryEnterpriseCountVO">
        SELECT
        management_area_city area,
        COUNT(*) AS enterpriseCount
        FROM
        biz_es_delivery_enterprise
        where 1=1
        <if test="param.managementAreaCity!=null and param.managementAreaCity!=''">
            and
            management_area_city =#{param.managementAreaCity}
        </if>
        GROUP BY
        management_area_city

    </select>
    <select id="selectCountyCount"
            resultType="com.unis.emergencySupport.modular.es.entity.vo.EsDeliveryEnterpriseCountVO">
        SELECT
        management_area_county area,
        COUNT(*) AS enterpriseCount
        FROM
        biz_es_delivery_enterprise
        where 1=1
        <if test="param.managementAreaCity!=null and param.managementAreaCity!=''">
            and
            management_area_city =#{param.managementAreaCity}
        </if>
        <if test="param.managementAreaCounty!=null and param.managementAreaCounty!=''">
            and
            management_area_county =#{param.managementAreaCounty}
        </if>

        GROUP BY
        management_area_county

    </select>

</mapper>