From b954d7a119eb635394bf4ff3619a9ab4b4978e48 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Thu, 02 Apr 2026 09:33:34 +0800
Subject: [PATCH] sql改造首页

---
 drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml b/drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml
index aa6cd48..b32c485 100644
--- a/drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml
+++ b/drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml
@@ -24,11 +24,11 @@
         from
             ja_gd_manage_device md
         left join
-                blade_dept bd on md.create_dept = bd.id
+                blade_dept bd on md.create_dept = bd.id::VARCHAR
         <where>
                 and md.is_deleted = 0
-            <if test="param2.deviceName != null and param2.deviceName != ''">
-                and md.nickname like concat('%',#{param2.deviceName},'%')
+            <if test="param2.nickname != null and param2.nickname != ''">
+                and md.nickname like concat('%',#{param2.nickname},'%')
             </if>
             <if test="param2.deptId != null">
                 and md.create_dept = #{param2.deptId}
@@ -36,6 +36,13 @@
             <if test="param2.location != null and param2.location != ''">
                 and md.location like concat('%',#{param2.location},'%')
             </if>
+            <if test="param2.modeCode != null and param2.modeCode != ''">
+                and md.mode_code = #{param2.modeCode}
+            </if>
+            <if test="param2.deviceType != null and param2.deviceType != ''">
+                and md.device_type = #{param2.deviceType}
+            </if>
+
         </where>
     </select>
 
@@ -60,19 +67,22 @@
             d2.height as height
         from
             ja_gd_manage_device md
-        left join ja_gd_manage_device d2 on md.device_sn = d2.device_sn and d2.device_type = '0'
+        left join ja_gd_manage_device d2 on md.device_sn = d2.device_sn::VARCHAR and d2.device_type = '0'
         <where>
             <if test="deviceIds != null and deviceIds.size() > 0">
-                and id in
+                and md.id in
                 <foreach item="item" collection="deviceIds" index="index" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
             </if>
             <if test="devicePayload != null and devicePayload != ''">
-                and device_payload like concat('%',#{devicePayload},'%')
+                and md.device_payload like concat('%',#{devicePayload},'%')
             </if>
             <if test="geom != null and geom != ''">
-                and ST_Intersects(geom, ST_GeomFromText(#{geom}))
+                and ST_Intersects(md.geom, ST_GeomFromText(#{geom}))
+            </if>
+            <if test="deviceType != null and deviceType != '' ">
+                and md.device_type = #{deviceType}
             </if>
                 and md.is_deleted = 0
         </where>

--
Gitblit v1.9.3