From 4e48664942bbefe70699ca43d25cbbd56ecc8daa Mon Sep 17 00:00:00 2001
From: xiebin <vip_xiaobin810@163.com>
Date: Mon, 19 Jan 2026 15:17:12 +0800
Subject: [PATCH] update-维修计划状态更新、新增定时器修改状态

---
 drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml |   83 +++++++++++++++++++++++++++++++++--------
 1 files changed, 67 insertions(+), 16 deletions(-)

diff --git a/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml b/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
index d561a38..5fff6b6 100644
--- a/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
+++ b/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
@@ -156,29 +156,80 @@
         left join ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0
         <where>
             ad.is_deleted = 0
-            <choose>
-                <when test="sceneId != null">
-                    and exists (
+            <if test="filterSelected != null and filterSelected == 1">
+                and (
+                    not exists (
                         select 1
                         from ja_fw_defense_scene ds
                         where ds.is_deleted = 0
-                          and ds.id = #{sceneId}
                           and ds.area_divide_ids is not null
                           and ds.area_divide_ids != ''
                           and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
                     )
-                </when>
-                <when test="filterSelected != null and filterSelected == 1">
-                    and not exists (
-                        select 1
-                        from ja_fw_defense_scene ds
-                        where ds.is_deleted = 0
-                          and ds.area_divide_ids is not null
-                          and ds.area_divide_ids != ''
-                          and find_in_set(ad.id, ds.area_divide_ids)
-                    )
-                </when>
-            </choose>
+                    <if test="sceneId != null">
+                        or exists (
+                            select 1
+                            from ja_fw_defense_scene ds
+                            where ds.is_deleted = 0
+                              and ds.id = #{sceneId}
+                              and ds.area_divide_ids is not null
+                              and ds.area_divide_ids != ''
+                              and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
+                        )
+                    </if>
+                )
+            </if>
+            <if test="sceneId != null and (filterSelected == null or filterSelected != 1)">
+                and exists (
+                    select 1
+                    from ja_fw_defense_scene ds
+                    where ds.is_deleted = 0
+                      and ds.id = #{sceneId}
+                      and ds.area_divide_ids is not null
+                      and ds.area_divide_ids != ''
+                      and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
+                )
+            </if>
+        </where>
+    </select>
+
+    <select id="selectFwAreaDivideListByDeviceIds" resultMap="fwAreaDivideResultMap">
+        select
+        ad.id,
+        ad.area_name,
+        ad.device_ids
+        from ja_fw_area_divide ad
+        <where>
+            ad.is_deleted = 0
+            and ad.device_ids is not null
+            and ad.device_ids != ''
+            <if test="deviceIds != null and deviceIds.size > 0">
+                and (
+                    <foreach collection="deviceIds" item="deviceId" separator=" or ">
+                        find_in_set(#{deviceId}, replace(ad.device_ids, ' ', ''))
+                    </foreach>
+                )
+            </if>
+        </where>
+    </select>
+
+    <select id="selectFwDefenseSceneListByAreaIds" resultType="org.sxkj.fw.area.vo.FwDefenseSceneVO">
+        select
+        ds.id,
+        ds.scene_name as sceneName,
+        ds.area_divide_ids as areaDivideIds
+        from ja_fw_defense_scene ds
+        <where>
+            ds.is_deleted = 0
+            and ds.area_divide_ids is not null
+            and ds.area_divide_ids != ''
+            <if test="areaIds != null and areaIds.size > 0">
+                and (
+                    <foreach collection="areaIds" item="areaId" separator=" or ">
+                        find_in_set(#{areaId}, replace(ds.area_divide_ids, ' ', ''))
+                    </foreach>
+                )
+            </if>
         </where>
     </select>
 

--
Gitblit v1.9.3