zrj
2024-10-31 2237bc8d0fd0aed40c7daf7398cb89c65a74b7ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?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="org.springblade.modules.yw.mapper.EmergencySpaceMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="emergencySpaceResultMap" type="org.springblade.modules.yw.entity.EmergencySpaceEntity">
        <result column="id" property="id"/>
        <result column="name" property="name"/>
        <result column="type" property="type"/>
        <result column="main_func" property="mainFunc"/>
        <result column="lng" property="lng"/>
        <result column="lat" property="lat"/>
        <result column="pre_level" property="preLevel"/>
        <result column="capacity" property="capacity"/>
        <result column="remark" property="remark"/>
        <result column="firm_id" property="firmId"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectEmergencySpacePage" resultMap="emergencySpaceResultMap">
        select * from yw_emergency_space where is_deleted = 0
    </select>
 
    <!--获取应急空间统计数据-->
    <select id="getStatisticData" resultType="java.util.Map">
        SELECT
            case when type=1 then '应急池'
            when type =2 then '阀门'
            when type =3 then '公共管网'
            when type =4 then '污水提升泵站'
            when type =5 then '水库'
            when type =6 then '应急泵'
            when type =7 then '消防沙'
            end as type,
            count(*) as num
        FROM
            yw_emergency_space
        WHERE
            is_deleted = 0
            AND type IS NOT NULL
            AND firm_id IS NOT NULL
            GROUP BY type
    </select>
 
</mapper>