fix(测试跟踪): 功能用例复制功能未复制自定义字段

--bug=1027270 --user=王旭 【测试跟踪】功能用例-自定义字段-复制用例到其他模块-自定义字段内容消失 https://www.tapd.cn/55049933/s/1385069
This commit is contained in:
WangXu10 2023-06-25 11:17:43 +08:00 committed by fit2-zhao
parent 2c11c028f9
commit c754d78880
1 changed files with 13 additions and 0 deletions

View File

@ -3148,6 +3148,7 @@ public class TestCaseService {
mapper.insert(testCase); mapper.insert(testCase);
dealWithCopyOtherInfo(testCase, oldTestCaseId); dealWithCopyOtherInfo(testCase, oldTestCaseId);
copyCustomFields(oldTestCaseId, id);
if (i % 50 == 0) if (i % 50 == 0)
sqlSession.flushStatements(); sqlSession.flushStatements();
} }
@ -3157,6 +3158,18 @@ public class TestCaseService {
} }
} }
private void copyCustomFields(String oldTestCaseId, String id) {
CustomFieldTestCaseExample example = new CustomFieldTestCaseExample();
example.createCriteria().andResourceIdEqualTo(oldTestCaseId);
List<CustomFieldTestCase> customFieldTestCases = customFieldTestCaseMapper.selectByExampleWithBLOBs(example);
if (CollectionUtils.isNotEmpty(customFieldTestCases)) {
customFieldTestCases.forEach(customFieldTestCase -> {
customFieldTestCase.setResourceId(id);
customFieldTestCaseMapper.insertSelective(customFieldTestCase);
});
}
}
public List<TestCaseDTO> getTestCaseVersions(String caseId) { public List<TestCaseDTO> getTestCaseVersions(String caseId) {
TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(caseId); TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(caseId);
if (testCase == null) { if (testCase == null) {