fix: 脑图创建用例自定义ID为空

This commit is contained in:
chenjianxing 2021-07-21 16:40:27 +08:00 committed by jianxing
parent 28cab9b097
commit 0433f5b652
3 changed files with 18 additions and 6 deletions

View File

@ -141,6 +141,9 @@ public class TestCaseService {
testCase.setUpdateTime(System.currentTimeMillis());
checkTestCustomNum(testCase);
testCase.setNum(getNextNum(testCase.getProjectId()));
if (StringUtils.isBlank(testCase.getCustomNum())) {
testCase.setCustomNum(testCase.getNum().toString());
}
testCase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
testCase.setDemandId(testCase.getDemandId());
testCase.setDemandName(testCase.getDemandName());
@ -1247,14 +1250,19 @@ public class TestCaseService {
return;
}
TestCaseExample example = new TestCaseExample();
List<String> editIds = data.stream()
.filter(t -> StringUtils.isNotBlank(t.getId()) && t.getId().length() > 20)
.map(TestCaseWithBLOBs::getId).collect(Collectors.toList());
example.createCriteria().andIdIn(editIds);
List<TestCaseWithBLOBs> testCaseWithBLOBs = testCaseMapper.selectByExampleWithBLOBs(example);
Map<String, TestCaseWithBLOBs> testCaseMap = testCaseWithBLOBs.stream().collect(Collectors.toMap(TestCaseWithBLOBs::getId, t -> t));
Map<String, TestCaseWithBLOBs> testCaseMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(editIds)) {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdIn(editIds);
List<TestCaseWithBLOBs> testCaseWithBLOBs = testCaseMapper.selectByExampleWithBLOBs(example);
testCaseMap = testCaseWithBLOBs.stream().collect(Collectors.toMap(TestCaseWithBLOBs::getId, t -> t));
}
Map<String, TestCaseWithBLOBs> finalTestCaseMap = testCaseMap;
data.forEach(item -> {
if (StringUtils.isBlank(item.getNodeId()) || item.getNodeId().equals("root")) {
item.setNodeId("");
@ -1265,7 +1273,7 @@ public class TestCaseService {
item.setMaintainer(SessionUtils.getUserId());
addTestCase(item);
} else {
TestCaseWithBLOBs dbCase = testCaseMap.get(item.getId());
TestCaseWithBLOBs dbCase = finalTestCaseMap.get(item.getId());
if (editCustomFieldsPriority(dbCase, item.getPriority())) {
item.setCustomFields(dbCase.getCustomFields());
};

View File

@ -149,4 +149,8 @@ export default {
</script>
<style scoped>
/deep/ .el-table--border, .el-table--group {
border: 0px;
}
</style>

View File

@ -65,7 +65,7 @@
</el-tooltip>
<el-tooltip :content="$t('test_track.case.unlink')"
placement="top" :enterable="false">
<el-button type="danger" icon="el-icon-delete" size="mini"
<el-button type="danger" icon="el-icon-unlock" size="mini"
circle :disabled="scope.row.platform !== 'Local'"
@click="deleteIssue(scope.row)"
/>