From 28cb936f50ab83b36861f12dc8ab2793b9898e51 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Tue, 07 Apr 2026 19:49:28 +0800
Subject: [PATCH] opt: 人大金仓数据库改造

---
 drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceMapper.xml |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 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 49d0046..f2fcf1c 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
@@ -40,19 +40,19 @@
 
     <select id="selectFwDevicePage" resultMap="fwDeviceResultMap">
         select
-            *
+        *
         from
-            ja_fw_device
+        ja_fw_device
         <where>
-                is_deleted = 0
+            is_deleted = 0
             <if test="param2.id != null and param2.id != ''">
-                and id = #{param2.id}
+                and id::text = #{param2.id}::text
             </if>
             <if test="param2.deviceName != null and param2.deviceName != ''">
                 and device_name like concat('%',#{param2.deviceName},'%')
             </if>
             <if test="param2.deviceType != null and param2.deviceType != ''">
-                and device_type = #{param2.deviceType}
+                and device_type::text = #{param2.deviceType}::text
             </if>
             <if test="param2.deviceModel != null and param2.deviceModel != ''">
                 and device_model = #{param2.deviceModel}
@@ -77,30 +77,30 @@
                 and belong_dept = #{param2.belongDept}
             </if>
             <if test="param2.deviceStatusList != null and param2.deviceStatusList != ''">
-                and status in
+                and status::text in
                 <foreach item="item" collection="param2.deviceStatusList" separator="," open="(" close=")" index="">
-                    #{item}
+                    #{item}::text
                 </foreach>
             </if>
             <if test="param2.status != null">
-                and status = #{param2.status}
+                and status::text = #{param2.status}::text
             </if>
             <if test="param2.isTrack != null and param2.isTrack == 1">
-                and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id::VARCHAR = tmp.device_id::VARCHAR) > 0
+                and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id::text = tmp.device_id::text) > 0
             </if>
             <if test="param2.isTrack != null and param2.isTrack == 2">
-                and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id::VARCHAR = tmp.device_id::VARCHAR) = 0
+                and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id::text = tmp.device_id::text) = 0
             </if>
             <if test="param2.deptList != null and param2.deptList.size > 0">
-                and ( create_dept in
+                and ( create_dept::text in
                 <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")">
-                    #{deptId}
+                    #{deptId}::text
                 </foreach>
-                <!-- 或者设备是共享给当前部门的 -->
                 <if test="param2.currentDeptId != null and param2.currentDeptId != '' ">
                     or id in (
                     SELECT device_id FROM ja_fw_device_per_share
-                    WHERE loan_to_dept_id = #{param2.currentDeptId}
+                    WHERE
+                    loan_to_dept_id = #{param2.currentDeptId}::bigint
                     AND is_deleted = 0
                     )
                 </if>
@@ -108,7 +108,7 @@
             </if>
         </where>
         order by
-            create_time desc
+        create_time desc
     </select>
 
     <select id="selectFwDeviceList" resultMap="fwDeviceResultMap">

--
Gitblit v1.9.3