package com.ruoyi.system.service.impl;
|
|
import java.util.List;
|
import java.util.Map;
|
import org.springframework.stereotype.Service;
|
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.system.mapper.TTestMapper;
|
import com.ruoyi.system.service.ITTestService;
|
import com.ruoyi.system.service.ITestDataQueryService;
|
|
/** 测试数据查询模块;实现不访问设备或模拟器历史。 */
|
@Service
|
public class TestDataQueryServiceImpl implements ITestDataQueryService
|
{
|
private final TTestMapper mapper;
|
private final ITTestService tests;
|
|
public TestDataQueryServiceImpl(TTestMapper mapper, ITTestService tests)
|
{
|
this.mapper = mapper;
|
this.tests = tests;
|
}
|
|
@Override public List<Map<String, Object>> records(Long testId)
|
{
|
requireTest(testId);
|
return mapper.selectPersistedRecords(testId);
|
}
|
|
@Override public List<Map<String, Object>> steps(Long testId)
|
{
|
requireTest(testId);
|
return mapper.selectPersistedSteps(testId);
|
}
|
|
@Override public List<Map<String, Object>> cycles(Long testId)
|
{
|
requireTest(testId);
|
return mapper.selectPersistedCycles(testId);
|
}
|
|
private void requireTest(Long testId)
|
{
|
if (testId == null || tests.selectTestById(testId) == null)
|
throw new ServiceException("测试不存在");
|
}
|
}
|