From 50d9e71d9ef65da6bdf3c84bdaa4c97a2755599b Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Fri, 05 Dec 2025 15:32:43 +0800
Subject: [PATCH] 1. 去掉盒子别名类型字段。

---
 ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml |  119 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 90 insertions(+), 29 deletions(-)

diff --git a/ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml b/ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml
index 0a3a216..69048e7 100644
--- a/ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml
+++ b/ard-work/src/main/resources/mapper/ArdDroneInfoMapper.xml
@@ -10,7 +10,7 @@
         <result property="boxName"    column="box_name"    />
         <result property="boxVersion"    column="box_version"    />
         <result property="startTime"    column="start_time"    />
-        <result property="onLine"    column="onLine"    />
+        <result property="onLine"    column="on_line"    />
         <result property="videoServer"    column="video_server"    />
         <result property="videoPort"    column="video_port"    />
         <result property="lastTaskId"    column="last_task_id"    />
@@ -21,46 +21,54 @@
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
-        <result property="serverInfoId"    column="server_info_id"    />
+        <result property="serverId"    column="server_id"    />
         <!-- 关联 ArdServerInfo 对象 -->
         <association property="ardServerInfo"
                      javaType="com.ard.work.domain.entity.ArdServerInfo"
-                     column="server_info_id"
+                     column="server_id"
                      autoMapping="true"
                      select="selectArdServerInfo">
         </association>
     </resultMap>
 
     <select id="selectArdServerInfo" resultType="com.ard.work.domain.entity.ArdServerInfo">
-        select * from ard_server_info where id = #{serverInfoId}
+        select * from ard_server where id = #{serverId}
     </select>
 
     <sql id="selectArdDroneVo">
-        select id,
-            box_sn,
-            box_name,
-            box_version,
-            start_time,
-            on_line,
-            video_server,
-            video_port,
-            last_task_id,
-            server_info_id,
-            user_id,
-            dept_id
-        from ard_drone_info
+        select c.id,
+               c.box_sn,
+               c.box_name,
+               c.box_version,
+               c.start_time,
+               c.on_line,
+               c.video_server,
+               c.video_port,
+               c.last_task_id,
+               c.server_id,
+               c.user_id,
+               c.dept_id,
+               c.box_alias_name
+        from ard_drone c
+                 left join sys_dept d on d.dept_id = c.dept_id
+                 left join sys_user u on u.user_id = c.user_id
     </sql>
 
     <select id="selectArdDroneList" parameterType="ArdDroneInfo" resultMap="ArdDroneInfoResult">
         <include refid="selectArdDroneVo"/>
-        <where>  
-            <if test="boxSn != null  and boxSn != ''"> and box_sn = #{boxSn}</if>
-            <if test="boxName != null  and boxName != ''"> and box_name like concat('%', #{boxName}, '%')</if>
-            <if test="boxVersion != null  and boxVersion != ''"> and box_version = #{boxVersion}</if>
-            <if test="onLine != null "> and onLine = #{onLine}</if>
-            <if test="lastTaskId != null "> and last_task_id = #{lastTaskId}</if>
-            <if test="userId != null "> and user_id = #{userId}</if>
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
+        <where>
+            <if test="boxSn != null  and boxSn != ''"> and c.box_sn like concat('%', #{boxSn}, '%')</if>
+            <if test="boxName != null  and boxName != ''"> and c.box_name like concat('%', #{boxName}, '%')</if>
+            <if test="boxVersion != null  and boxVersion != ''"> and c.box_version = #{boxVersion}</if>
+            <if test="onLine != null "> and c.onLine = #{onLine}</if>
+            <if test="lastTaskId != null "> and c.last_task_id = #{lastTaskId}</if>
+            <if test="userId != null "> and c.user_id = #{userId}</if>
+            <if test="deptId != null and deptId != 0">
+                and (d.dept_id = #{deptId} OR d.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
+                find_in_set(#{deptId}, ancestors) ))
+            </if>
+            <!-- 数据范围过滤 -->
+            ${params.dataScope}
         </where>
     </select>
     
@@ -73,7 +81,7 @@
         where box_sn = #{boxSn}
     </select>
     <insert id="insertArdDrone" parameterType="ArdDroneInfo">
-        insert into ard_drone_info
+        insert into ard_drone
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>
             <if test="boxSn != null">box_sn,</if>
@@ -84,6 +92,7 @@
             <if test="videoServer != null">video_server,</if>
             <if test="videoPort != null">video_port,</if>
             <if test="lastTaskId != null">last_task_id,</if>
+            <if test="serverId != null">server_id,</if>
             <if test="userId != null">user_id,</if>
             <if test="deptId != null">dept_id,</if>
             <if test="createBy != null">create_by,</if>
@@ -102,6 +111,7 @@
             <if test="videoServer != null">#{videoServer},</if>
             <if test="videoPort != null">#{videoPort},</if>
             <if test="lastTaskId != null">#{lastTaskId},</if>
+            <if test="serverId != null">#{serverId},</if>
             <if test="userId != null">#{userId},</if>
             <if test="deptId != null">#{deptId},</if>
             <if test="createBy != null">#{createBy},</if>
@@ -113,7 +123,7 @@
     </insert>
 
     <update id="updateArdDrone" parameterType="ArdDroneInfo">
-        update ard_drone_info
+        update ard_drone
         <trim prefix="SET" suffixOverrides=",">
             <if test="boxSn != null">box_sn = #{boxSn},</if>
             <if test="boxName != null">box_name = #{boxName},</if>
@@ -123,6 +133,7 @@
             <if test="videoServer != null">video_server = #{videoServer},</if>
             <if test="videoPort != null">video_port = #{videoPort},</if>
             <if test="lastTaskId != null">last_task_id = #{lastTaskId},</if>
+            <if test="serverId != null">server_id = #{serverId},</if>
             <if test="userId != null">user_id = #{userId},</if>
             <if test="deptId != null">dept_id = #{deptId},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
@@ -135,13 +146,63 @@
     </update>
 
     <delete id="deleteArdDroneById" parameterType="String">
-        delete from ard_drone_info where id = #{id}
+        delete from ard_drone where id = #{id}
     </delete>
 
     <delete id="deleteArdDroneByIds" parameterType="String">
-        delete from ard_drone_info where id in
+        delete from ard_drone where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
+
+    <insert id="insertArdDroneLs" parameterType="java.util.List">
+        insert into ard_drone(
+            id,
+            box_sn,
+            box_name,
+            box_version,
+            start_time,
+            on_line,
+            video_server,
+            video_port,
+            last_task_id,
+            server_id,
+            user_id,
+            dept_id,
+            create_by,
+            create_time,
+            update_by,
+            update_time,
+            remark
+        ) values
+        <foreach item="item" index="index" collection="list" separator=",">
+            (#{item.id},
+            #{item.boxSn},
+            #{item.boxName},
+            #{item.boxVersion},
+            #{item.startTime},
+            #{item.onLine},
+            #{item.videoServer},
+            #{item.videoPort},
+            #{item.lastTaskId},
+            #{item.serverId},
+            #{item.userId},
+            #{item.deptId},
+            #{item.createBy},
+            #{item.createTime},
+            #{item.updateBy},
+            #{item.updateTime},
+            #{item.remark})
+        </foreach>
+    </insert>
+
+    <update id="updateDroneStatus">
+        update ard_drone
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="onLine != null">on_line = #{onLine},</if>
+        </trim>
+        where server_id = #{serverId}
+    </update>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3