From 0f83725a97d7f8d30484f1c34ac220c965cee374 Mon Sep 17 00:00:00 2001
From: xiebin <vip_xiaobin810@163.com>
Date: Tue, 13 Jan 2026 15:30:43 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml |   40 +++++++++++++++++++++++++++++++++-------
 1 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml b/drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml
index 5185494..779463f 100644
--- a/drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml
+++ b/drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml
@@ -82,13 +82,39 @@
         <where>
             is_deleted = 0
             <if test="isAreaSelect != null and isAreaSelect == 1">
-                and not exists (
-                    select 1
-                    from ja_fw_area_divide ad
-                    where ad.is_deleted = 0
-                    and ad.device_ids is not null
-                    and ad.device_ids != ''
-                    and find_in_set(ja_fw_device.id, ad.device_ids)
+                and (
+                    <choose>
+                        <when test="areaId != null">
+                            exists (
+                                select 1
+                                from ja_fw_area_divide ad
+                                where ad.is_deleted = 0
+                                and ad.id = #{areaId}
+                                and ad.device_ids is not null
+                                and ad.device_ids != ''
+                                and find_in_set(ja_fw_device.id, ad.device_ids)
+                            )
+                            or not exists (
+                                select 1
+                                from ja_fw_area_divide ad
+                                where ad.is_deleted = 0
+                                and ad.device_ids is not null
+                                and ad.device_ids != ''
+                                and find_in_set(ja_fw_device.id, ad.device_ids)
+                                and ad.id != #{areaId}
+                            )
+                        </when>
+                        <otherwise>
+                            not exists (
+                                select 1
+                                from ja_fw_area_divide ad
+                                where ad.is_deleted = 0
+                                and ad.device_ids is not null
+                                and ad.device_ids != ''
+                                and find_in_set(ja_fw_device.id, ad.device_ids)
+                            )
+                        </otherwise>
+                    </choose>
                 )
             </if>
         </where>

--
Gitblit v1.9.3