From dac47617b37ccfb834cd73ce0ee725e1101de214 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 14 八月 2025 17:25:51 +0800 Subject: [PATCH] 2025.8.14 1. 动态溯源模块添加滑动平均异常计算(调试中) --- src/main/resources/mapper/SourceTraceMsgBlobMapper.xml | 56 ++++++++++++++++++ src/main/kotlin/com/flightfeather/uav/domain/mapper/SourceTraceMsgBlobMapper.kt | 20 ++++++ src/main/kotlin/com/flightfeather/uav/domain/entity/SourceTraceMsgBlob.java | 57 +++++++++++++++++++ 3 files changed, 133 insertions(+), 0 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/SourceTraceMsgBlob.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/SourceTraceMsgBlob.java new file mode 100644 index 0000000..4e21650 --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/domain/entity/SourceTraceMsgBlob.java @@ -0,0 +1,57 @@ +package com.flightfeather.uav.domain.entity; + +import javax.persistence.*; + +@Table(name = "source_trace_msg_blob") +public class SourceTraceMsgBlob { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @Column(name = "msg_id") + private Integer msgId; + + private String content; + + /** + * @return id + */ + public Integer getId() { + return id; + } + + /** + * @param id + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * @return msg_id + */ + public Integer getMsgId() { + return msgId; + } + + /** + * @param msgId + */ + public void setMsgId(Integer msgId) { + this.msgId = msgId; + } + + /** + * @return content + */ + public String getContent() { + return content; + } + + /** + * @param content + */ + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/SourceTraceMsgBlobMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/SourceTraceMsgBlobMapper.kt new file mode 100644 index 0000000..7802760 --- /dev/null +++ b/src/main/kotlin/com/flightfeather/uav/domain/mapper/SourceTraceMsgBlobMapper.kt @@ -0,0 +1,20 @@ +package com.flightfeather.uav.domain.mapper + +import com.flightfeather.uav.domain.MyMapper +import com.flightfeather.uav.domain.entity.SourceTraceMsgBlob +import com.flightfeather.uav.lightshare.bean.SourceTraceMsgVo +import org.apache.ibatis.annotations.Mapper +import org.apache.ibatis.annotations.Select +import java.util.* + +@Mapper +interface SourceTraceMsgBlobMapper : MyMapper<SourceTraceMsgBlob?> { + + fun selectWithBlob(deviceCode: String, startTime: Date, endTime: Date): List<SourceTraceMsgVo?> + + /** + * 閲嶇疆鑷id + */ + @Select("alter table source_trace_msg_blob auto_increment = #{param1}") + fun resetAutoIncrement(id: Int) +} \ No newline at end of file diff --git a/src/main/resources/mapper/SourceTraceMsgBlobMapper.xml b/src/main/resources/mapper/SourceTraceMsgBlobMapper.xml new file mode 100644 index 0000000..c350230 --- /dev/null +++ b/src/main/resources/mapper/SourceTraceMsgBlobMapper.xml @@ -0,0 +1,56 @@ +<?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.flightfeather.uav.domain.mapper.SourceTraceMsgBlobMapper"> + <resultMap id="BaseResultMap" type="com.flightfeather.uav.domain.entity.SourceTraceMsgBlob"> + <!-- + WARNING - @mbg.generated + --> + <id column="id" jdbcType="INTEGER" property="id" /> + <result column="msg_id" jdbcType="INTEGER" property="msgId" /> + </resultMap> + <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.flightfeather.uav.domain.entity.SourceTraceMsgBlob"> + <!-- + WARNING - @mbg.generated + --> + <result column="content" jdbcType="LONGVARCHAR" property="content" /> + </resultMap> + <sql id="Base_Column_List"> + <!-- + WARNING - @mbg.generated + --> + id, msg_id + </sql> + <sql id="Blob_Column_List"> + <!-- + WARNING - @mbg.generated + --> + content + </sql> + + <resultMap extends="com.flightfeather.uav.domain.mapper.SourceTraceMsgMapper.BaseResultMap" + id="SourceTraceMsgVoMap" + type="com.flightfeather.uav.lightshare.bean.SourceTraceMsgVo"> + </resultMap> + + <select id="selectWithBlob" resultMap="SourceTraceMsgVoMap"> + select + a.*, + b.id as blobId, + b.msg_id as blobMsgId, + b.content as blobContent + from source_trace_msg as a left join source_trace_msg_blob as b + on a.id = b.msg_id + <where> + <if test="deviceCode != null"> + and a.device_code = #{deviceCode} + </if> + <if test="startTime != null"> + and a.start_time >= #{startTime} + </if> + <if test="endTime != null"> + and a.end_time <= #{endTime} + </if> + </where> + order by a.start_time desc + </select> +</mapper> \ No newline at end of file -- Gitblit v1.9.3