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.TTestPlanStep; import com.ruoyi.system.domain.TTestResult; import com.ruoyi.system.domain.TTestWarningThreshold; import com.ruoyi.system.domain.TDetectionChannel; import com.ruoyi.system.domain.TTestReceptionInterval; import com.ruoyi.system.domain.vo.TestBatteryOptionVo; import com.ruoyi.system.domain.vo.TestChannelOptionVo; import com.ruoyi.system.domain.vo.TestCollectorOptionVo; import com.ruoyi.system.domain.vo.TestTypeOptionVo; import com.ruoyi.system.domain.vo.TestUserOptionVo; /** 测试配置及其只追加审计的数据访问接口。 */ public interface TTestMapper { TTest selectTestById(Long testId); TTest selectTestByIdForUpdate(Long testId); List selectTestList(TTest test); List selectBatteryNosByTestIds(@Param("testIds") List 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 deleteTestPlanStepsByTestId(Long testId); int deleteTestBatteriesByTestId(Long testId); int deleteTestFieldsByTestId(Long testId); int deleteTestThresholdsByTestId(Long testId); int insertTestPlanStep(TTestPlanStep step); int insertTestBattery(TTestBattery battery); int insertTestBatteryField(TTestBatteryField field); int insertTestChannelBinding(TTestChannelBinding binding); int insertTestCollectorChannel(TTestCollectorChannel mapping); int insertTestThreshold(TTestWarningThreshold threshold); List selectTestPlanSteps(Long testId); List selectTestBatteries(Long testId); List selectTestBatteryFields(Long testId); List selectTestChannelBindings(Long testId); List selectTestCollectorChannels(Long testId); List selectTestThresholds(Long testId); List selectTestResults(TTestResult result); 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); List selectEnabledUserOptions(); List selectEnabledTestTypeOptions(); List selectEnabledBatteryOptions(); List selectRegisteredChannelOptions(); List selectEnabledCollectorOptions(); 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); boolean collectorOnline(Long collectorId); int updateReceptionStarted(@Param("testId") Long testId, @Param("startedAtUtc") Date startedAtUtc, @Param("updateBy") String updateBy); int insertReceptionInterval(TTestReceptionInterval interval); }