72 lines
3.0 KiB
XML
72 lines
3.0 KiB
XML
<?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.BoatWaypointMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.central.device.boat.entity.BoatWaypoint">
|
|
<id column="id" property="id" />
|
|
<result column="waypoint_id" property="waypointId" />
|
|
<result column="route_id" property="routeId" />
|
|
<result column="waypoint_index" property="waypointIndex" />
|
|
<result column="longitude" property="longitude" />
|
|
<result column="latitude" property="latitude" />
|
|
<result column="speed" property="speed" />
|
|
<result column="stay_duration" property="stayDuration" />
|
|
<result column="heading_angle" property="headingAngle" />
|
|
<result column="turn_mode" property="turnMode" />
|
|
<result column="actions" property="actions" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" />
|
|
<result column="is_key_point" property="isKeyPoint" />
|
|
<result column="point_name" property="pointName" />
|
|
<result column="remark" property="remark" />
|
|
<result column="create_time" property="createTime" />
|
|
<result column="update_time" property="updateTime" />
|
|
</resultMap>
|
|
|
|
<!-- 根据航线ID查询航点列表(按序号排序) -->
|
|
<select id="selectByRouteIdOrderByIndex" resultMap="BaseResultMap">
|
|
SELECT * FROM boat_waypoint
|
|
WHERE route_id = #{routeId}
|
|
ORDER BY waypoint_index ASC
|
|
</select>
|
|
|
|
<!-- 根据航线ID删除航点 -->
|
|
<delete id="deleteByRouteId">
|
|
DELETE FROM boat_waypoint
|
|
WHERE route_id = #{routeId}
|
|
</delete>
|
|
|
|
<!-- 批量插入航点 -->
|
|
<insert id="batchInsert">
|
|
INSERT INTO boat_waypoint (
|
|
waypoint_id, route_id, waypoint_index,
|
|
longitude, latitude, speed, stay_duration,
|
|
heading_angle, turn_mode, actions,
|
|
is_key_point, point_name, remark,
|
|
create_time, update_time
|
|
) VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(
|
|
#{item.waypointId}, #{item.routeId}, #{item.waypointIndex},
|
|
#{item.longitude}, #{item.latitude}, #{item.speed}, #{item.stayDuration},
|
|
#{item.headingAngle}, #{item.turnMode},
|
|
#{item.actions, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
|
|
#{item.isKeyPoint}, #{item.pointName}, #{item.remark},
|
|
NOW(), NOW()
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 根据航线ID统计航点数量 -->
|
|
<select id="countByRouteId" resultType="int">
|
|
SELECT COUNT(*) FROM boat_waypoint
|
|
WHERE route_id = #{routeId}
|
|
</select>
|
|
|
|
<!-- 根据航点ID查询 -->
|
|
<select id="selectByWaypointId" resultMap="BaseResultMap">
|
|
SELECT * FROM boat_waypoint
|
|
WHERE waypoint_id = #{waypointId}
|
|
</select>
|
|
|
|
</mapper>
|