From 08d4bb2bf4bfadc9ab5fcf6b0a2bfb543d22b2a0 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Thu, 05 Feb 2026 10:13:10 +0800
Subject: [PATCH] 工单优化

---
 drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdManageDeviceMapper.xml |   51 ++++++++++++++++++++++++++-------------------------
 1 files changed, 26 insertions(+), 25 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 6e1b1f4..2c1f565 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
@@ -19,15 +19,7 @@
 
     <select id="selectGdManageDevicePage" resultMap="gdManageDeviceResultMap">
         select
-            md.id,
-            md.device_sn,
-            md.device_name,
-            md.nickname,
-            md.mode_code,
-            md.device_payload,
-            md.longitude,
-            md.latitude,
-            md.location,
+            md.*,
             bd.dept_name as device_dept_name
         from
             ja_gd_manage_device md
@@ -35,9 +27,6 @@
                 blade_dept bd on md.create_dept = bd.id
         <where>
                 and md.is_deleted = 0
-            <if test="param2.deviceName != null and param2.deviceName != ''">
-                and md.device_name like concat('%',#{param2.deviceName},'%')
-            </if>
             <if test="param2.nickname != null and param2.nickname != ''">
                 and md.nickname like concat('%',#{param2.nickname},'%')
             </if>
@@ -47,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,30 +56,35 @@
 
     <select id="selectGdManageDevice" resultType="org.sxkj.gd.workorder.vo.GdManageDeviceVO">
         select
-            id,
-            device_sn,
-            device_name,
-            nickname,
-            device_payload,
-            longitude,
-            latitude,
-            geom
+            md.id,
+            md.device_sn,
+            md.device_name,
+            md.nickname,
+            md.device_payload,
+            md.longitude,
+            md.latitude,
+            md.geom,
+            d2.height as height
         from
-            ja_gd_manage_device
+            ja_gd_manage_device md
+        left join ja_gd_manage_device d2 on md.device_sn = d2.device_sn 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>
-                and is_deleted = 0
+            <if test="deviceType != null and deviceType != '' ">
+                and md.device_type = #{deviceType}
+            </if>
+                and md.is_deleted = 0
         </where>
     </select>
 

--
Gitblit v1.9.3