<?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="cn.com.taiji.beidou.ship.track.mapper.ShipTrackMapper">

    <resultMap type="shipTrackResult" id="shipTrackResult">
        <id property="id" column="id"/>
        <result property="deviceId" column="device_id"/>
        <result property="sendTime" column="send_time"/>
        <result property="longitude" column="longitude"/>
        <result property="latitude" column="latitude"/>
        <result property="direction" column="direction"/>
        <result property="speed" column="speed"/>
    </resultMap>

    <select id="selectShipTrackDetail" parameterType="shipTrackReq" resultMap="shipTrackResult">
        select id,device_id,send_time,longitude,latitude,direction,speed from ax_beidou_track track
        where track.device_id = #{deviceId}
        <if test="endTime != null and endTime != ''">and track.location_time &lt; #{endTime}</if>
        <if test="startTime != null and startTime != ''">and track.location_time &gt; #{startTime}</if>
        order by track.location_time ASC
    </select>
</mapper>