吉安感知网项目-后端
rain
2026-01-13 f0ad850a7a962dcf53c6c88e31de4bc2b1e20457
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>