吉安感知网项目-后端
rain
2026-02-03 194160c0a5475cadb7557c1ea58dcec6c53e781d
设备列表查询新增多个区域信息

Signed-off-by: rain <1679827795@qq.com>
1 files modified
94 ■■■■ changed files
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml 94 ●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml
@@ -104,68 +104,60 @@
        select * from ja_fw_device
        <where>
            is_deleted = 0
            <if test="isAreaSelect != null and isAreaSelect == 1">
                and (
                <choose>
                    <when test="areaIds != null and areaIds.size > 0">
            <choose>
                <when test="areaIds != null and areaIds.size > 0">
                    and (
                        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)
                    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
                                and ad.device_ids != ''
                                and find_in_set(ja_fw_device.id, ad.device_ids)
                    )
                </when>
                <when test="isAreaSelect != null and isAreaSelect == 1">
                    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}
                            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)
                            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>
                    )
                </when>
            </choose>
            <if test="status != null">
                and status = #{status}
            </if>