fix(性能测试): 修复删除测试时bug

This commit is contained in:
Captain.B 2021-05-25 11:18:45 +08:00 committed by 刘瑞斌
parent 36b4c7a70b
commit 7572ccdcbb
1 changed files with 2 additions and 10 deletions

View File

@ -117,21 +117,13 @@ public class PerformanceTestService {
// delete load_test // delete load_test
loadTestMapper.deleteByPrimaryKey(request.getId()); loadTestMapper.deleteByPrimaryKey(request.getId());
deleteFileByTestId(request.getId()); detachFileByTestId(request.getId());
} }
public void deleteFileByTestId(String testId) { public void detachFileByTestId(String testId) {
LoadTestFileExample loadTestFileExample = new LoadTestFileExample(); LoadTestFileExample loadTestFileExample = new LoadTestFileExample();
loadTestFileExample.createCriteria().andTestIdEqualTo(testId); loadTestFileExample.createCriteria().andTestIdEqualTo(testId);
final List<LoadTestFile> loadTestFiles = loadTestFileMapper.selectByExample(loadTestFileExample);
loadTestFileMapper.deleteByExample(loadTestFileExample); loadTestFileMapper.deleteByExample(loadTestFileExample);
if (!CollectionUtils.isEmpty(loadTestFiles)) {
List<String> fileIds = loadTestFiles.stream().map(LoadTestFile::getFileId).collect(Collectors.toList());
LoadTestFileExample example3 = new LoadTestFileExample();
example3.createCriteria().andFileIdIn(fileIds);
loadTestFileMapper.deleteByExample(example3);
}
} }
public String save(SaveTestPlanRequest request, List<MultipartFile> files) { public String save(SaveTestPlanRequest request, List<MultipartFile> files) {