| | |
| | | <!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} |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="getOnlineCommanderPosition" parameterType="java.lang.String" resultType="java.util.Map"> |
| | | select su.user_name as "userName",su.nick_name as "nickName", |
| | | aap.user_id as "userId",aap.longitude,aap.latitude,aap.altitude, |
| | | aap.speed,aap.bearing,aap.create_time as "createTime" |
| | | from ard_app_application aaa |
| | | inner join sys_user su on aaa.commander_id = su.user_id |
| | | inner join ard_app_position aap on su.user_id = aap.user_id |
| | | where aaa.soilder_id = #{soilderId} and aaa.application_type = 'Commander' |
| | | and aaa.state = '1' and su.app_online_state = '1' |
| | | order by aap.create_time desc limit 1 offset 0 |
| | | </select> |
| | | |
| | | <select id="getAPPPositionByUserIdAndTime" parameterType="java.lang.String" resultMap="ArdAppPositionResult"> |
| | | select * from ard_app_position aap |
| | | where aap.user_id = #{userId} and aap.create_time >= #{beginTime} |
| | | and aap.create_time <= #{endTime} order by aap.create_time asc |
| | | </select> |
| | | </mapper> |