单次解算记录持久化写入数据库

- 新增单次解析实体类与 Mapper
This commit is contained in:
fengyarnom 2024-11-05 09:32:06 +08:00
parent 9511027878
commit 27783443c2
4 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,44 @@
package com.imdroid.secapi.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import lombok.Data;
@Data
@TableName(value = "gnssdevicesinglerecords")
public class GnssSingleData {
public static final short MODEL_G505 = 0; //F9P
public static final short MODEL_G510 = 1; //博通
@TableId(value = "id", type = IdType.AUTO)
@ExcelIgnore
Long id;
@ExcelProperty("设备编号")
String deviceid;
@ExcelProperty("记录时间")
LocalDateTime createtime;
// 博通的 GGA 经纬度数据
// F9P 的私有格式 B562 ECEF 数据
@ExcelProperty("型号")
Short model;
@ExcelProperty("")
double x; // GGA时是 latitude, ECEF时是 x
@ExcelProperty("")
double y; // GGA时是 longitude, ECEF时是 y
@ExcelProperty("")
double z; // GGA时是 altitude, ECEF时是 z
// GGA GPS状态0初始化1单点定位2码差分3无效PPS4固定解5浮点解6正在估算7人工输入固定值8模拟模式9WAAS差分
// ECEF 0无B562,1 浮点解,2 固定解
@ExcelProperty("状态")
int status;
}

View File

@ -0,0 +1,14 @@
package com.imdroid.secapi.dto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface GnssSingleDataMapper extends MPJBaseMapper<GnssSingleData> {
Page<GnssSingleData> queryByDeviceId(@Param("page") IPage page, @Param("deviceId") String deviceId,
@Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("count") Integer count);
}

View File

@ -0,0 +1,18 @@
<?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.GnssSingleDataMapper">
<select id="queryByDeviceId" resultType="com.imdroid.secapi.dto.GnssSingleData">
select c.* from (select @n:=@n+1 as n, a.* from (select * from gnssdevicesinglerecords
<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>

View File

@ -35,6 +35,7 @@ public class Device {
private String fwdId; private String fwdId;
private Integer deviceType; private Integer deviceType;
private Short model;
private Integer calcGroupId; private Integer calcGroupId;
private Short opMode; private Short opMode;