feat: 航线解析以及websocket订阅不关闭bug修复
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.central.device.mapper.DroneFlightTrackMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.central.device.entity.DroneFlightTrack">
|
||||
<id column="id" property="id" />
|
||||
<result column="device_sn" property="deviceSn" />
|
||||
<result column="job_id" property="jobId" />
|
||||
<result column="route_id" property="routeId" />
|
||||
<result column="longitude" property="longitude" />
|
||||
<result column="latitude" property="latitude" />
|
||||
<result column="altitude" property="altitude" />
|
||||
<result column="height" property="height" />
|
||||
<result column="horizontal_speed" property="horizontalSpeed" />
|
||||
<result column="vertical_speed" property="verticalSpeed" />
|
||||
<result column="heading" property="heading" />
|
||||
<result column="pitch" property="pitch" />
|
||||
<result column="roll" property="roll" />
|
||||
<result column="flight_mode" property="flightMode" />
|
||||
<result column="battery_percent" property="batteryPercent" />
|
||||
<result column="deviation_distance" property="deviationDistance" />
|
||||
<result column="is_deviation" property="isDeviation" />
|
||||
<result column="record_time" property="recordTime" />
|
||||
<result column="tenant_id" property="tenantId" />
|
||||
<result column="create_time" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据设备SN和查询条件获取轨迹点 -->
|
||||
<select id="selectTrackPoints" resultMap="BaseResultMap">
|
||||
SELECT * FROM drone_flight_track
|
||||
WHERE 1=1
|
||||
<if test="deviceSn != null and deviceSn != ''">
|
||||
AND device_sn = #{deviceSn}
|
||||
</if>
|
||||
<if test="jobId != null and jobId != ''">
|
||||
AND job_id = #{jobId}
|
||||
</if>
|
||||
<if test="routeId != null and routeId != ''">
|
||||
AND route_id = #{routeId}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND record_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND record_time <= #{endTime}
|
||||
</if>
|
||||
ORDER BY record_time ASC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据设备SN获取最新的轨迹点 -->
|
||||
<select id="selectLatestTrackPoint" resultMap="BaseResultMap">
|
||||
SELECT * FROM drone_flight_track
|
||||
WHERE device_sn = #{deviceSn}
|
||||
ORDER BY record_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 根据设备SN删除指定时间范围的轨迹 -->
|
||||
<delete id="deleteByDeviceSnAndTimeBefore">
|
||||
DELETE FROM drone_flight_track
|
||||
WHERE device_sn = #{deviceSn}
|
||||
AND record_time < #{beforeTime}
|
||||
</delete>
|
||||
|
||||
<!-- 统计轨迹点数量 -->
|
||||
<select id="countTrackPoints" resultType="java.lang.Long">
|
||||
SELECT COUNT(*) FROM drone_flight_track
|
||||
WHERE 1=1
|
||||
<if test="deviceSn != null and deviceSn != ''">
|
||||
AND device_sn = #{deviceSn}
|
||||
</if>
|
||||
<if test="jobId != null and jobId != ''">
|
||||
AND job_id = #{jobId}
|
||||
</if>
|
||||
<if test="routeId != null and routeId != ''">
|
||||
AND route_id = #{routeId}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND record_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND record_time <= #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 批量插入轨迹点 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO drone_flight_track (
|
||||
device_sn, job_id, route_id, longitude, latitude, altitude, height,
|
||||
horizontal_speed, vertical_speed, heading, pitch, roll, flight_mode,
|
||||
battery_percent, deviation_distance, is_deviation, record_time,
|
||||
tenant_id, create_time
|
||||
) VALUES
|
||||
<foreach collection="trackPoints" item="item" separator=",">
|
||||
(
|
||||
#{item.deviceSn}, #{item.jobId}, #{item.routeId}, #{item.longitude}, #{item.latitude},
|
||||
#{item.altitude}, #{item.height}, #{item.horizontalSpeed}, #{item.verticalSpeed},
|
||||
#{item.heading}, #{item.pitch}, #{item.roll}, #{item.flightMode}, #{item.batteryPercent},
|
||||
#{item.deviationDistance}, #{item.isDeviation}, #{item.recordTime}, #{item.tenantId}, NOW()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据航线任务ID删除飞行轨迹 -->
|
||||
<delete id="deleteByRouteId">
|
||||
DELETE FROM drone_flight_track
|
||||
WHERE route_id = #{routeId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user