<?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.imdroid.secapi.dto.GnssCalcDataMapper">

    <select id="queryByDeviceId" resultType="com.imdroid.secapi.dto.GnssCalcData">
        select c.* from (select @n:=@n+1 as n, a.* from (select * from gnssdevicelocationrecords
        <where>
            deviceid = #{deviceId}
            <if test="beginTime != null and beginTime != ''">
                and createtime &gt;= #{beginTime}
            </if>
            <if test="endTime != null and endTime != ''">
                and createtime &lt;= #{endTime}
            </if>
        </where>
        order by createtime desc)a,(select @n:=0)b)c where c.n%#{count}=1
    </select>
</mapper>
