洪城义警-正式版后台
zengh
2021-08-10 a2fb06f8f5f685d753780b3d5befc5417f15af3a
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -29,6 +29,7 @@
        <result column="work_status" property="work_status"/>
        <result column="examination_type" property="examination_type"/>
        <result column="examination_mx" property="examination_mx"/>
        <result column="district" property="district"/>
    </resultMap>
    <resultMap id="userResultMaps" type="org.springblade.modules.system.vo.UsersVo">
        <result column="id" property="id"/>
@@ -243,9 +244,9 @@
            left join
        blade_region br
            on
        bu.region_id = br.code
            where bu.region_id is not null
        group by bu.region_id
        bu.district = br.code
            where bu.district is not null
        group by bu.district
    </select>
    <!-- 统计六大队伍数量 -->
@@ -304,4 +305,24 @@
        WHERE
            dept.id = '1424616047083905026'
    </select>
    <select id="getUserDistrictTypeCount" resultType="org.springblade.modules.system.vo.UserDistrictStatisVO">
        SELECT
            br.NAME AS region,
            count( * ) num ,
            count( CASE WHEN dept.dept_name = '治保会队伍' THEN 1 END) as zbh,
            count( CASE WHEN dept.dept_name = '内保干部队伍' THEN 1 END) as nbgb,
            count( CASE WHEN dept.dept_name = '治安巡防队伍' THEN 1 END) as zaxf,
            count( CASE WHEN dept.dept_name = '信息员队伍' THEN 1 END) as xxy,
            count( CASE WHEN dept.dept_name = '保安员队伍' THEN 1 END) as bay,
            count( CASE WHEN dept.dept_name = '警务辅助队伍' THEN 1 END) as jwfz
        FROM
            blade_user bu
            LEFT JOIN blade_region br ON bu.district = br.CODE
            LEFT JOIN blade_dept dept ON substring_index( substring_index( bu.dept_id, ',', 3 ), ',',- 1 ) = dept.id
        WHERE
            bu.district IS NOT NULL
        GROUP BY
            bu.district
    </select>
</mapper>