package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.stereotype.Service; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.system.domain.TTestIntegrityIssue; import com.ruoyi.system.mapper.TTestMapper; import com.ruoyi.system.service.ITTestService; import com.ruoyi.system.service.ITestIntegrityService; /** 完整性查询只返回持久化问题事实,不把实时快照当作历史结果。 */ @Service public class TestIntegrityServiceImpl implements ITestIntegrityService { private final TTestMapper mapper; private final ITTestService tests; public TestIntegrityServiceImpl(TTestMapper mapper, ITTestService tests) { this.mapper = mapper; this.tests = tests; } /** 返回持久化完整性问题和历史异常事实,不把实时快照当作最终结果。 */ @Override public List selectIssues(Long testId) { if (testId == null) throw new ServiceException("测试ID不能为空"); tests.selectTestById(testId); List issues = new java.util.ArrayList<>(); List integrity = mapper.selectIntegrityIssues(testId); if (integrity != null) issues.addAll(integrity); List exceptions = mapper.selectTestExceptionFacts(testId); if (exceptions != null) issues.addAll(exceptions); return issues; } }