yeg
2026-08-30 ec3308617909c8d6280e0d00ffb18350e372fbdf
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TTestMapper.java
@@ -1,16 +1,19 @@
package com.ruoyi.system.mapper;
import java.util.List;
import java.util.Date;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.TTest;
import com.ruoyi.system.domain.TTestBattery;
import com.ruoyi.system.domain.TTestBatteryField;
import com.ruoyi.system.domain.TTestChannelBinding;
import com.ruoyi.system.domain.TTestCollectorChannel;
import com.ruoyi.system.domain.TTestFieldSnapshot;
import com.ruoyi.system.domain.TTestPlanStep;
import com.ruoyi.system.domain.TTestResult;
import com.ruoyi.system.domain.TTestWarningThreshold;
import com.ruoyi.system.domain.TTestCollectorSource;
import com.ruoyi.system.domain.TTestCollectorExceptionInterval;
import com.ruoyi.system.domain.TDetectionChannel;
import com.ruoyi.system.domain.vo.TestBatteryOptionVo;
import com.ruoyi.system.domain.vo.TestChannelOptionVo;
import com.ruoyi.system.domain.vo.TestCollectorOptionVo;
@@ -23,13 +26,13 @@
    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 deleteTestBindingsByTestId(Long testId);
    int deleteTestCollectorChannelsByTestId(Long testId);
    int deleteTestFieldSnapshotsByTestId(Long testId);
    int deleteTestPlanStepsByTestId(Long testId);
    int deleteTestBatteriesByTestId(Long testId);
    int deleteTestFieldsByTestId(Long testId);
@@ -39,14 +42,12 @@
    int insertTestBatteryField(TTestBatteryField field);
    int insertTestChannelBinding(TTestChannelBinding binding);
    int insertTestCollectorChannel(TTestCollectorChannel mapping);
    int insertTestFieldSnapshot(TTestFieldSnapshot snapshot);
    int insertTestThreshold(TTestWarningThreshold threshold);
    List<TTestPlanStep> selectTestPlanSteps(Long testId);
    List<TTestBattery> selectTestBatteries(Long testId);
    List<TTestBatteryField> selectTestBatteryFields(Long testId);
    List<TTestChannelBinding> selectTestChannelBindings(Long testId);
    List<TTestCollectorChannel> selectTestCollectorChannels(Long testId);
    List<TTestFieldSnapshot> selectTestFieldSnapshots(Long testId);
    List<TTestWarningThreshold> selectTestThresholds(Long testId);
    List<TTestResult> selectTestResults(TTestResult result);
    int countTestTypeEnabled(Long testTypeId);
@@ -63,4 +64,40 @@
    int insertTestAudit(@Param("testId") Long testId, @Param("eventType") String eventType,
            @Param("actorId") Long actorId, @Param("actorName") String actorName,
            @Param("previousValue") String previousValue, @Param("newValue") String newValue);
    /** 锁定检测柜通道的最新可观测事实,供开始接收校验使用。 */
    TDetectionChannel selectReceptionChannelForUpdate(Long channelId);
    /** 锁定当前检测柜通道租约;返回空表示可接入。 */
    TTestChannelBinding selectChannelLeaseForUpdate(Long channelId);
    int insertChannelLease(@Param("channelId") Long channelId, @Param("testId") Long testId,
            @Param("bindingId") Long bindingId, @Param("acquiredBy") Long acquiredBy,
            @Param("acquiredAtUtc") Date acquiredAtUtc);
    int insertCollectorChannelLease(@Param("collectorId") Long collectorId, @Param("channelCode") String channelCode,
            @Param("testId") Long testId, @Param("bindingId") Long bindingId,
            @Param("acquiredBy") Long acquiredBy, @Param("acquiredAtUtc") Date acquiredAtUtc);
    int deleteChannelLeasesByTestId(Long testId);
    int deleteCollectorChannelLeasesByTestId(Long testId);
    int hasReceivingTestForAdapter(@Param("adapterCode") String adapterCode);
    int hasPausedOrEndedTestForAdapter(@Param("adapterCode") String adapterCode);
    List<TDetectionChannel> selectReceivingChannelsForAdapter(@Param("adapterCode") String adapterCode);
    boolean collectorOnline(Long collectorId);
    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);
    /** 查询仍在接收中的采集器来源。 */
    List<TTestCollectorSource> selectReceivingCollectorSources();
    /** 查询来源当前开放的断线区间。 */
    TTestCollectorExceptionInterval selectOpenCollectorException(@Param("testId") Long testId,
            @Param("batteryRelationId") Long batteryRelationId, @Param("collectorId") Long collectorId,
            @Param("channelCode") String channelCode);
    int insertCollectorExceptionInterval(TTestCollectorExceptionInterval interval);
    int closeCollectorExceptionInterval(@Param("intervalId") Long intervalId,
            @Param("recoveredAtUtc") Date recoveredAtUtc, @Param("missingToUtc") Date missingToUtc);
    List<TTestCollectorExceptionInterval> selectCollectorExceptionIntervals(Long testId);
}