zhongrj
2024-12-02 1b571842429899c253c8bce5c6e01aedb056416a
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
51
52
53
54
55
56
57
58
59
60
61
62
63
<?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">
 
    <!--自定义分页查询-->
    <select id="selectEmergencySpacePage" resultType="org.springblade.modules.yw.vo.EmergencySpaceVO">
        select
        yes.id,yes.name,yes.full_name,yes.type,yes.main_func,yes.lng,yes.lat,yes.pre_level,
        yes.capacity,yes.remark,yes.firm_id,yes.image_url,ST_AsGeoJSON(yes.geom) as geom,yes.ele,
        yfi.name as firmName,
        bdb.dict_value as emergencySpaceType
        from yw_emergency_space yes
        left join blade_dict_biz bdb on bdb.dict_key = yes.type and bdb.code = 'emergency_space_type'
        left join yw_firm_info yfi on yfi.id = yes.firm_id and yfi.is_deleted = 0
        where yes.is_deleted = 0
        <if test="emergencySpace.name!=null and emergencySpace.name!=''">
            and yes.name like concat('%',#{emergencySpace.name},'%')
        </if>
        <if test="emergencySpace.firmId!=null">
            and yes.firm_id = #{emergencySpace.firmId}
        </if>
        <if test="emergencySpace.type!=null">
            and yes.type = #{emergencySpace.type}
        </if>
        <if test="emergencySpace.preLevel!=null">
            and yes.pre_level = #{emergencySpace.preLevel}
        </if>
    </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 =8 then '沟渠'
            when type =9 then '废水处理站'
            when type =10 then '排水口'
            when type =11 then '污水池'
            end as type,
            count(*) as num
        FROM
            yw_emergency_space
        WHERE
            is_deleted = 0
            and type != 7
            AND type IS NOT NULL
            GROUP BY type
    </select>
 
    <!--获取应急池容量-->
    <select id="getEmePool" resultType="java.lang.String">
        SELECT
            sum( capacity ) AS num
        FROM
            yw_emergency_space
        WHERE type = 1  AND is_deleted = 0
    </select>
 
</mapper>