|  |  |  | 
|---|
|  |  |  | <!DOCTYPE mapper | 
|---|
|  |  |  | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | 
|---|
|  |  |  | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
|---|
|  |  |  | <mapper namespace="com.ruoyi.app.mapper.ArdAppPositionMapper"> | 
|---|
|  |  |  | <mapper namespace="com.ruoyi.app.position.mapper.ArdAppPositionMapper"> | 
|---|
|  |  |  | <resultMap type="ArdAppPosition" id="ArdAppPositionResult"> | 
|---|
|  |  |  | <result property="id" column="id"/> | 
|---|
|  |  |  | <result property="userId" column="user_id"/> | 
|---|
|  |  |  | <result property="longitude" column="longitude"/> | 
|---|
|  |  |  | <result property="latitude" column="latitude"/> | 
|---|
|  |  |  | <result property="altitude" column="altitude"/> | 
|---|
|  |  |  | <result property="speed" column="speed"/> | 
|---|
|  |  |  | <result property="bearing" column="bearing"/> | 
|---|
|  |  |  | <result property="createTime" column="create_time"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="selectArdAppPositionVo"> | 
|---|
|  |  |  | select id, user_id, longitude, latitude, altitude, create_time | 
|---|
|  |  |  | select id, user_id, longitude, latitude, altitude,speed, bearing, create_time | 
|---|
|  |  |  | from ard_app_position | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <include refid="selectArdAppPositionVo"/> | 
|---|
|  |  |  | where id = #{id} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectLastArdAppPositionByUserId" parameterType="String" resultMap="ArdAppPositionResult"> | 
|---|
|  |  |  | <include refid="selectArdAppPositionVo"/> | 
|---|
|  |  |  | where user_id = #{userId} | 
|---|
|  |  |  | order by create_time desc | 
|---|
|  |  |  | limit 1 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <insert id="insertArdAppPosition" parameterType="ArdAppPosition"> | 
|---|
|  |  |  | insert into ard_app_position | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="longitude != null">longitude,</if> | 
|---|
|  |  |  | <if test="latitude != null">latitude,</if> | 
|---|
|  |  |  | <if test="altitude != null">altitude,</if> | 
|---|
|  |  |  | <if test="speed != null">speed,</if> | 
|---|
|  |  |  | <if test="bearing != null">bearing,</if> | 
|---|
|  |  |  | <if test="createTime != null">create_time,</if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="longitude != null">#{longitude},</if> | 
|---|
|  |  |  | <if test="latitude != null">#{latitude},</if> | 
|---|
|  |  |  | <if test="altitude != null">#{altitude},</if> | 
|---|
|  |  |  | <if test="speed != null">#{speed},</if> | 
|---|
|  |  |  | <if test="bearing != null">#{bearing},</if> | 
|---|
|  |  |  | <if test="createTime != null">#{createTime},</if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </insert> | 
|---|
|  |  |  | 
|---|
|  |  |  | <if test="longitude != null">longitude = #{longitude},</if> | 
|---|
|  |  |  | <if test="latitude != null">latitude = #{latitude},</if> | 
|---|
|  |  |  | <if test="altitude != null">altitude = #{altitude},</if> | 
|---|
|  |  |  | <if test="speed != null">speed = #{speed},</if> | 
|---|
|  |  |  | <if test="bearing != null">bearing = #{bearing},</if> | 
|---|
|  |  |  | <if test="createTime != null">create_time = #{createTime},</if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | where id = #{id} | 
|---|