吉安感知网项目-后端
xiebin
2026-01-28 74756c657109a4e48dd6c0b4d8959cdab89b33a9
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?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.sxkj.fw.area.mapper.FwDefenseSceneMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="fwDefenseSceneResultMap" type="org.sxkj.fw.area.vo.FwDefenseSceneVO">
        <result column="id" property="id"/>
        <result column="scene_name" property="sceneName"/>
        <result column="scene_type" property="sceneType"/>
        <result column="longitude" property="longitude"/>
        <result column="latitude" property="latitude"/>
        <result column="defense_leader" property="defenseLeader"/>
        <result column="leader_phone" property="leaderPhone"/>
        <result column="defense_area" property="defenseArea"/>
        <result column="device_mode" property="deviceMode"/>
        <result column="area_divide_ids" property="areaDivideIds"/>
        <result column="area_code" property="areaCode"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
    </resultMap>
 
 
    <select id="selectFwDefenseScenePage" resultMap="fwDefenseSceneResultMap">
        select
            *
        from
            ja_fw_defense_scene
        <where>
                and is_deleted = 0
            <if test="param2.id != null and param2.id != ''">
                and id = #{param2.id}
            </if>
            <if test="param2.sceneName != null and param2.sceneName != ''">
                and scene_name like concat('%', #{param2.sceneName}, '%')
            </if>
            <if test="param2.sceneType != null and param2.sceneType != ''">
                and scene_type = #{param2.sceneType}
            </if>
            <if test="param2.longitude != null and param2.longitude != ''">
                and longitude = #{param2.longitude}
            </if>
            <if test="param2.latitude != null and param2.latitude != ''">
                and latitude = #{param2.latitude}
            </if>
            <if test="param2.defenseLeader != null and param2.defenseLeader != ''">
                and defense_leader like concat('%', #{param2.defenseLeader}, '%')
            </if>
            <if test="param2.leaderPhone != null and param2.leaderPhone != ''">
                and leader_phone = #{param2.leaderPhone}
            </if>
            <if test="param2.defenseArea != null and param2.defenseArea != ''">
                and defense_area = #{param2.defenseArea}
            </if>
            <if test="param2.deviceMode != null and param2.deviceMode != ''">
                and device_mode = #{param2.deviceMode}
            </if>
            <if test="param2.areaDivideIds != null and param2.areaDivideIds != ''">
                and area_divide_ids = #{param2.areaDivideIds}
            </if>
            <if test="param2.areaCode != null and param2.areaCode != ''">
                and area_code = #{param2.areaCode}
            </if>
            <if test="param2.createUser != null and param2.createUser != ''">
                and create_user = #{param2.createUser}
            </if>
            <if test="param2.createDept != null and param2.createDept != ''">
                and create_dept = #{param2.createDept}
            </if>
            <if test="param2.createTime != null and param2.createTime != ''">
                and create_time = #{param2.createTime}
            </if>
            <if test="param2.updateUser != null and param2.updateUser != ''">
                and update_user = #{param2.updateUser}
            </if>
            <if test="param2.updateTime != null and param2.updateTime != ''">
                and update_time = #{param2.updateTime}
            </if>
            <if test="param2.status != null and param2.status != ''">
                and status = #{param2.status}
            </if>
            <if test="param2.deptList != null and param2.deptList.size > 0">
                and create_dept in
                <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")">
                    #{deptId}
                </foreach>
            </if>
        </where>
    </select>
 
    <select id="selectFwDefenseSceneList" resultMap="fwDefenseSceneResultMap">
        select ds.* from ja_fw_defense_scene ds
        <where>
            ds.is_deleted = 0
            <if test="filterSelected != null and filterSelected == 1">
                and (
                    not exists (
                        select 1
                        from ja_fw_defense_zone dz
                        where dz.is_deleted = 0
                          and dz.defense_scene_ids is not null
                          and dz.defense_scene_ids != ''
                          and find_in_set(ds.id, dz.defense_scene_ids)
                    )
                    <if test="zoneId != null">
                        or exists (
                            select 1
                            from ja_fw_defense_zone dz
                            where dz.is_deleted = 0
                              and dz.id = #{zoneId}
                              and dz.defense_scene_ids is not null
                              and dz.defense_scene_ids != ''
                              and find_in_set(ds.id, dz.defense_scene_ids)
                        )
                    </if>
                )
            </if>
            <if test="areaId != null and (filterSelected == null or filterSelected != 1)">
                and ds.area_divide_ids is not null
                and ds.area_divide_ids != ''
                and find_in_set(#{areaId}, replace(ds.area_divide_ids, ' ', ''))
            </if>
        </where>
    </select>
 
 
    <select id="exportFwDefenseScene" resultType="org.sxkj.fw.area.excel.FwDefenseSceneExcel">
        SELECT * FROM ja_fw_defense_scene ${ew.customSqlSegment}
    </select>
 
</mapper>