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 |  122 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 120 insertions(+), 2 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 46a84c4..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
@@ -52,7 +52,11 @@
         ad.longitude,
         ad.latitude,
         ad.area_size,
-        concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom)) as geom,
+        case
+            when ad.geom is null then null
+            when ST_SRID(ad.geom) is null or ST_SRID(ad.geom) = 0 then ST_AsText(ad.geom)
+            else concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom))
+        end as geom,
         ad.area_type,
         ad.trigger_condition,
         ad.response_mechanism,
@@ -119,6 +123,116 @@
         </where>
     </select>
 
+    <select id="selectFwAreaDivideList" resultMap="fwAreaDivideResultMap">
+        select
+        ad.id,
+        ad.area_name,
+        ad.longitude,
+        ad.latitude,
+        ad.area_size,
+        case
+            when ad.geom is null then null
+            when ST_SRID(ad.geom) is null or ST_SRID(ad.geom) = 0 then ST_AsText(ad.geom)
+            else concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom))
+        end as geom,
+        ad.area_type,
+        ad.trigger_condition,
+        ad.response_mechanism,
+        ad.control_level,
+        ad.police_station_id,
+        ad.device_ids,
+        ad.fly_date_start,
+        ad.fly_date_end,
+        ad.area_code,
+        ps.station_name as police_station_name,
+        ad.create_user,
+        ad.create_dept,
+        ad.create_time,
+        ad.update_user,
+        ad.update_time,
+        ad.status,
+        ad.is_deleted
+        from ja_fw_area_divide ad
+        left join ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0
+        <where>
+            ad.is_deleted = 0
+            <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.area_divide_ids is not null
+                          and ds.area_divide_ids != ''
+                          and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
+                    )
+                    <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>
+
     <select id="selectFwAreaDivideDetail" resultMap="fwAreaDivideResultMap">
         select
         ad.id,
@@ -126,7 +240,11 @@
         ad.longitude,
         ad.latitude,
         ad.area_size,
-        concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom)) as geom,
+        case
+            when ad.geom is null then null
+            when ST_SRID(ad.geom) is null or ST_SRID(ad.geom) = 0 then ST_AsText(ad.geom)
+            else concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom))
+        end as geom,
         ad.area_type,
         ad.trigger_condition,
         ad.response_mechanism,

--
Gitblit v1.9.3