springboot+mybatis-plus +mysql 架构,存储终端来GPS 经纬度数据,我想要在controller层获取最后一个(最新)的GPS 记录,这个用mybatis-plus 在Mapper中应该怎么做呢?
last("limit 1")
记录肯定有个记录时间字段吧,那么你在查询语句最后加上order by create_date desc limit 0,1,拿到的那条就是最新的。
order by create_date desc limit 0,1