From 716e79646c1b6f950d07096188c681cdbc9c077a Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Thu, 02 Apr 2026 09:11:59 +0800
Subject: [PATCH] sql改造
---
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 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 73a6a12..c9593d8 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
@@ -770,17 +770,18 @@
FROM
ja_fw_device d
LEFT JOIN ja_fw_area_divide ad
- ON find_in_set(d.id, ad.device_ids) > 0
- AND ad.is_deleted = 0
+ ON d.id = ANY(string_to_array(ad.device_ids, ',')::bigint[])
+ AND ad.is_deleted = 0
WHERE
d.is_deleted = 0
AND d.is_enabled = 1
AND d.final_outbound_area IS NOT NULL
<if test="regionCode != null and regionCode != ''">
- and ( d.final_outbound_area_code like concat(#{regionCode},'%')
+ and ( d.final_outbound_area_code::text LIKE concat(#{regionCode}, '%')
<if test="currentDeptId != null and currentDeptId != '' ">
- or d.id in (
- SELECT device_id FROM ja_fw_device_per_share
+ or d.id IN (
+ SELECT device_id::bigint
+ FROM ja_fw_device_per_share
WHERE loan_to_dept_id = #{currentDeptId}
AND is_deleted = 0
)
@@ -795,9 +796,9 @@
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, ' ', ''))
- and (dsm.effective_date_start is null or dsm.effective_date_start <= #{flyTime})
- and (dsm.effective_date_end is null or dsm.effective_date_end >= #{flyTime})
+ and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
+ and dsm.effective_date_start <= #{flyTime}::timestamp
+ and dsm.effective_date_end >= #{flyTime}::timestamp
)
</if>
GROUP BY
--
Gitblit v1.9.3