yeg
2026-09-05 890049eeece6fc94cd974368451cdc36ec89fdf4
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package com.battery.business.mapper;
 
import java.util.List;
import java.util.Date;
import org.apache.ibatis.annotations.Param;
import com.battery.business.domain.TTest;
import com.battery.business.domain.TTestBattery;
import com.battery.business.domain.CurrentBatteryField;
import com.battery.business.domain.TTestChannelBinding;
import com.battery.business.domain.TTestCollectorChannel;
import com.battery.business.domain.TTestWarningThreshold;
import com.battery.business.domain.TTestWarningException;
import com.battery.business.domain.TTestLogicStepMapping;
import com.battery.business.domain.TDetectionChannel;
import com.battery.business.domain.TTestDataRevisionAction;
import com.battery.business.domain.DataRevisionItem;
import com.battery.business.domain.TTestRealtimeRecord;
import com.battery.business.domain.TTestStepRecord;
import com.battery.business.domain.TTestCycleRecord;
import com.battery.business.domain.vo.TestBatteryOptionVo;
import com.battery.business.domain.vo.TestChannelOptionVo;
import com.battery.business.domain.vo.TestCollectorOptionVo;
import com.battery.business.domain.vo.TestTypeOptionVo;
import com.battery.business.domain.vo.TestUserOptionVo;
 
/** 读写测试配置、成功接收数据、修订记录和异常处理事实。 */
public interface TTestMapper
{
    int deleteTestWarningExceptionsByTestId(Long testId);
    int deleteTestLogicStepMappingsByTestId(Long testId);
    java.util.Map<String, Object> selectDataRecord(@Param("testId") Long testId, @Param("dataType") String dataType, @Param("recordId") Long recordId);
    int updateDataRecord(@Param("testId") Long testId, @Param("dataType") String dataType, @Param("recordId") Long recordId, @Param("values") java.util.Map<String, Object> values);
    int deleteDataRecord(@Param("testId") Long testId, @Param("dataType") String dataType, @Param("recordId") Long recordId);
    java.util.Map<String, Object> selectImportBinding(@Param("testId") Long testId, @Param("batteryNo") String batteryNo);
    /** 查询当前测试该类事实,供整页导入校验身份和内容冲突。 */
    List<java.util.Map<String, Object>> selectImportDataRecords(@Param("testId") Long testId, @Param("dataType") String dataType);
    int insertImportedDataRecord(@Param("dataType") String dataType, @Param("values") java.util.Map<String, Object> values);
    TTest selectTestById(Long testId);
    TTest selectTestByIdForUpdate(Long testId);
    List<TTest> selectTestList(TTest test);
    List<TTestBattery> selectBatteryNosByTestIds(@Param("testIds") List<Long> testIds);
    TTest selectTestByName(String testName);
    int insertTest(TTest test);
    int updateTest(TTest test);
    int deleteTestById(@Param("testId") Long testId, @Param("updateBy") String updateBy);
    int deleteTestThresholdRowsByTestId(Long testId);
    int deleteTestBindingsByTestId(Long testId);
    int deleteTestCollectorChannelsByTestId(Long testId);
 
    int deleteTestBatteriesByTestId(Long testId);
 
    int deleteTestThresholdsByTestId(Long testId);
 
    int insertTestBattery(TTestBattery battery);
 
    int insertTestChannelBinding(TTestChannelBinding binding);
    int insertTestCollectorChannel(TTestCollectorChannel mapping);
    int insertTestThreshold(TTestWarningThreshold threshold);
 
    List<TTestBattery> selectTestBatteries(Long testId);
 
    /** 读取测试所选电池组的当前字段值,不创建测试快照。 */
    List<CurrentBatteryField> selectCurrentBatteryFields(Long testId);
    List<TTestChannelBinding> selectTestChannelBindings(Long testId);
    List<TTestCollectorChannel> selectTestCollectorChannels(Long testId);
    List<TTestWarningThreshold> selectTestThresholds(Long testId);
    /** 以测试、指标和阈值规则为开放异常键原子聚合成功接收的超限值。 */
    int upsertWarningException(@Param("testId") Long testId, @Param("thresholdId") Long thresholdId,
            @Param("sourceType") String sourceType, @Param("sourceIdentity") String sourceIdentity,
            @Param("metricCode") String metricCode, @Param("value") java.math.BigDecimal value,
            @Param("unit") String unit, @Param("ruleSnapshot") String ruleSnapshot,
            @Param("severity") String severity, @Param("occurredAt") Date occurredAt);
    /** 查询绑定来源的离线事实,同一采集器的多通道绑定只返回一次。 */
    List<com.battery.business.domain.vo.OfflineTestSource> selectOfflineTestSources(Long testId);
    /** 以测试和来源身份聚合离线异常,不写入阈值或测量值。 */
    int upsertOfflineException(@Param("testId") Long testId, @Param("sourceType") String sourceType,
            @Param("sourceIdentity") String sourceIdentity, @Param("occurredAt") Date occurredAt);
    /** 查询已持久化的阈值及离线异常事实。 */
    List<TTestWarningException> selectWarningExceptions(@Param("testId") Long testId,
            @Param("status") String status);
    TTestWarningException selectWarningExceptionById(Long exceptionId);
    /** 仅将开放异常转为已关闭,原始异常事实仍保留。 */
    int closeWarningException(@Param("exceptionId") Long exceptionId, @Param("handledBy") Long handledBy,
            @Param("handledByName") String handledByName, @Param("handledAt") Date handledAt,
            @Param("handlingNote") String handlingNote);
    /** 查询当前正在接收的测试,供接收调度绑定测试事实。 */
    List<Long> selectReceivingTestIds();
 
    int insertRealtimeRecord(TTestRealtimeRecord record);
    String selectRealtimeRecordContentHash(@Param("testId") Long testId, @Param("testBatteryId") Long testBatteryId,
            @Param("captureSlotUtc") Date captureSlotUtc);
    int insertStepRecord(TTestStepRecord record);
    int insertCycleRecord(TTestCycleRecord record);
    String selectStepRecordContentHash(@Param("testBatteryId") Long testBatteryId,
            @Param("sourceIdentity") String sourceIdentity, @Param("dedupeKey") String dedupeKey);
    String selectCycleRecordContentHash(@Param("testBatteryId") Long testBatteryId,
            @Param("sourceIdentity") String sourceIdentity, @Param("dedupeKey") String dedupeKey);
    List<java.util.Map<String, Object>> selectPersistedFinalRealtimeRecords(@Param("testId") Long testId);
    List<java.util.Map<String, Object>> selectPersistedFinalStepRecords(@Param("testId") Long testId);
    List<java.util.Map<String, Object>> selectPersistedFinalCycleRecords(@Param("testId") Long testId);
    boolean wasAggregateDeleted(@Param("testId") Long testId, @Param("dataType") String dataType,
            @Param("testBatteryId") Long testBatteryId, @Param("sourceIdentity") String sourceIdentity, @Param("dedupeKey") String dedupeKey);
    boolean wasRealtimeSlotDeleted(@Param("testId") Long testId, @Param("testBatteryId") Long testBatteryId,
            @Param("captureSlotMillis") long captureSlotMillis);
 
 
 
 
 
 
    String selectLogicStepMappingsJson(Long testId);
    int updateLogicStepMappings(@Param("testId") Long testId, @Param("mappingsJson") String mappingsJson,
            @Param("updateBy") String updateBy, @Param("updateTime") Date updateTime);
    int updateConsoleDetail(@Param("testId") Long testId, @Param("detailJson") String detailJson,
            @Param("updateBy") String updateBy, @Param("updateTime") Date updateTime);
    int countTestTypeEnabled(Long testTypeId);
    int countUserEnabled(Long userId);
    int countBatteryInEnabledGroup(@Param("groupId") Long groupId, @Param("batteryNo") String batteryNo);
    int countRegisteredChannel(Long channelId);
    int countCollectorEnabled(Long collectorId);
    Integer selectCollectorChannelCount(Long collectorId);
    String selectCollectorCode(Long collectorId);
    List<TestUserOptionVo> selectEnabledUserOptions();
    List<TestTypeOptionVo> selectEnabledTestTypeOptions();
    List<TestBatteryOptionVo> selectEnabledBatteryOptions();
    List<TestChannelOptionVo> selectRegisteredChannelOptions();
    List<TestCollectorOptionVo> selectEnabledCollectorOptions();
 
 
    /** 锁定检测柜通道的最新可观测事实,供开始接收校验使用。 */
    TDetectionChannel selectReceptionChannelForUpdate(Long channelId);
    int hasReceivingTestForAdapter(@Param("adapterCode") String adapterCode);
    List<TDetectionChannel> selectReceivingChannelsForAdapter(@Param("adapterCode") String adapterCode);
    int updateReceptionStarted(@Param("testId") Long testId, @Param("startedAtUtc") Date startedAtUtc,
            @Param("runtimeAttach") boolean runtimeAttach, @Param("updateBy") String updateBy);
    int updateReceptionPaused(@Param("testId") Long testId, @Param("updateBy") String updateBy,
            @Param("updatedAtUtc") Date updatedAtUtc);
    int updateReceptionResumed(@Param("testId") Long testId, @Param("updateBy") String updateBy,
            @Param("updatedAtUtc") Date updatedAtUtc);
    int updateReceptionStopped(@Param("testId") Long testId, @Param("updateBy") String updateBy,
            @Param("endedAtUtc") Date endedAtUtc);
 
 
 
 
 
 
 
    int insertDataRevisionAction(TTestDataRevisionAction action);
    List<TTestDataRevisionAction> selectDataRevisionActions(TTestDataRevisionAction query);
    TTestDataRevisionAction selectDataRevisionActionById(Long actionId);
 
 
 
 
 
 
    int deleteRealtimeRecordsByIds(@Param("testId") Long testId, @Param("recordIds") List<Long> recordIds);
 
    int deleteStepRecordsByIds(@Param("testId") Long testId, @Param("recordIds") List<Long> recordIds);
    int deleteCycleRecordsByIds(@Param("testId") Long testId, @Param("recordIds") List<Long> recordIds);
 
    int deleteTestRealtimeRecordsByTestId(Long testId);
 
    int deleteTestStepRecordsByTestId(Long testId);
    int deleteTestCycleRecordsByTestId(Long testId);
    int deleteTestDataRevisionActionsByTestId(Long testId);
 
 
 
 
 
 
 
    int countTestBatteryNo(@Param("testId") Long testId, @Param("batteryNo") String batteryNo);
}