fix: 创建功能用例其他版本提示ID已存在
This commit is contained in:
parent
4374f42aa3
commit
35d3330b14
|
@ -254,11 +254,16 @@ public class TestCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkCustomNumExist(TestCaseWithBLOBs testCase) {
|
private void checkCustomNumExist(TestCaseWithBLOBs testCase) {
|
||||||
|
String id = testCase.getId();
|
||||||
|
TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(id);
|
||||||
TestCaseExample example = new TestCaseExample();
|
TestCaseExample example = new TestCaseExample();
|
||||||
example.createCriteria()
|
TestCaseExample.Criteria criteria = example.createCriteria();
|
||||||
.andCustomNumEqualTo(testCase.getCustomNum())
|
criteria.andCustomNumEqualTo(testCase.getCustomNum())
|
||||||
.andProjectIdEqualTo(testCase.getProjectId())
|
.andProjectIdEqualTo(testCase.getProjectId())
|
||||||
.andIdNotEqualTo(testCase.getId());
|
.andIdNotEqualTo(testCase.getId());
|
||||||
|
if (testCaseWithBLOBs != null && StringUtils.isNotBlank(testCaseWithBLOBs.getRefId())) {
|
||||||
|
criteria.andRefIdNotEqualTo(testCaseWithBLOBs.getRefId());
|
||||||
|
}
|
||||||
List<TestCase> list = testCaseMapper.selectByExample(example);
|
List<TestCase> list = testCaseMapper.selectByExample(example);
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
MSException.throwException(Translator.get("custom_num_is_exist"));
|
MSException.throwException(Translator.get("custom_num_is_exist"));
|
||||||
|
|
Loading…
Reference in New Issue