<?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.ruoyi.screen.mapper.ZongzhiScreenNetworkEcologyMapper">


    <select id="getArticles" resultType="com.ruoyi.screen.domain.response.ZongzhiArticlesResponse">
        select type, count(*) as count
        from tc_network_article group by type
    </select>
    <select id="getAppraiser" resultType="com.ruoyi.screen.domain.response.ZongzhiAppraiserResponse">
        select name as type, sum(percent) AS pt
        from tc_bjsj
        GROUP BY type
    </select>
    <select id="getAppraiserComplete"
            resultType="com.ruoyi.screen.domain.response.ZongzhiAppraiserCompleteResponse">
        select SUM(s.finish) b.name from(
        SELECT
        CASE
        WHEN LOCATE(',', area_id) = 0 THEN TRIM(TRAILING ']' FROM SUBSTR(area_id, LOCATE('[', area_id) + 1))
        ELSE TRIM(TRAILING ']' FROM SUBSTRING_INDEX(area_id, ',', -1))
        END AS area_id,finsh
        FROM tc_wpyrwwcl)s left join tc_town b on s.area_id = b.id
        GROUP BY s.area_id

    </select>
</mapper>