yeg
2026-09-29 b78295e8da96c3e5e76befeef9582ce5273dbb74
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.battery.business.mapper;
 
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.battery.business.domain.TDeviceIngestRecord;
import com.battery.business.domain.vo.TDeviceIngestChannel;
 
/**
 * 推式来源落地表的读写:接收端点写入厂商原始行,适配器读回统一观测(ADR-0065)。
 *
 * <p>写入一律用 insert ignore 与来源行身份唯一键:重复推送不改动既有事实,
 * 由调用方比较内容摘要判定"同内容重复"与"同身份不同内容"。
 */
public interface TDeviceIngestRecordMapper
{
    int insertIngestRecord(TDeviceIngestRecord record);
 
    /** 心跳行按来源唯一,用 upsert 覆盖接收时间:它承载"取数程序还在推"这一条事实。 */
    int upsertHeartbeat(TDeviceIngestRecord record);
 
    /** 返回该来源行已落库的内容摘要(小写十六进制);没有这一行时为空。 */
    String selectIngestRecordHashByKey(@Param("adapterCode") String adapterCode,
            @Param("payloadKind") String payloadKind, @Param("recordKey") String recordKey);
 
    /** 该来源最近一次收到推送的时间;从未收到推送时为空。 */
    Date selectHeartbeatAt(@Param("adapterCode") String adapterCode);
 
    /** 拓扑上报声明的通道清单,每条附带其最近一次采样行的设备时间。 */
    List<TDeviceIngestChannel> selectTopologyChannels(@Param("adapterCode") String adapterCode);
 
    /** 某通道最近一次采样行;没有采样行时为空。水位与实时观测都取它。 */
    TDeviceIngestRecord selectLatestSample(@Param("adapterCode") String adapterCode,
            @Param("devtype") int devtype, @Param("devid") int devid, @Param("subdevid") int subdevid,
            @Param("chlid") int chlid);
 
    /** 严格晚于 (设备时间, 协议序号) 的采样行,按二元组升序;水位为空表示不取数据。 */
    List<TDeviceIngestRecord> selectSamplesSince(@Param("adapterCode") String adapterCode,
            @Param("devtype") int devtype, @Param("devid") int devid, @Param("subdevid") int subdevid,
            @Param("chlid") int chlid, @Param("watermarkTime") Date watermarkTime,
            @Param("watermarkSequence") long watermarkSequence, @Param("limit") int limit);
}