From 74b5d54c1cf5dc585a2fe135f4ce4dd2b374b4dd Mon Sep 17 00:00:00 2001
From: rain <1679827795@qq.com>
Date: Tue, 03 Feb 2026 15:55:35 +0800
Subject: [PATCH] 设备列表查询新增多个区域信息

---
 drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 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 96e534b..cc36953 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
@@ -106,11 +106,37 @@
             is_deleted = 0
             <if test="isAreaSelect != null and isAreaSelect == 1">
                 and (
-                    <choose>
-                        <when test="areaId != null">
-                            exists (
-                                select 1
-                                from ja_fw_area_divide ad
+                <choose>
+                    <when test="areaIds != null and areaIds.size > 0">
+                        exists (
+                        select 1
+                        from ja_fw_area_divide ad
+                        where ad.is_deleted = 0
+                        and ad.id in
+                        <foreach collection="areaIds" item="areaIdItem" separator="," open="(" close=")">
+                            #{areaIdItem}
+                        </foreach>
+                        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 not in
+                        <foreach collection="areaIds" item="areaIdItem" separator="," open="(" close=")">
+                            #{areaIdItem}
+                        </foreach>
+                        )
+                    </when>
+                    <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

--
Gitblit v1.9.3