fix: 添加模块重名校验失效

This commit is contained in:
chenjianxing 2022-04-24 17:42:48 +08:00 committed by John Bro
parent 0dece32c19
commit 1a78d6aedd
4 changed files with 24 additions and 48 deletions

View File

@ -272,17 +272,13 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
ApiModuleExample example = new ApiModuleExample();
ApiModuleExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
.andProjectIdEqualTo(node.getProjectId())
.andLevelEqualTo(node.getLevel());
if (StringUtils.isNotBlank(node.getProtocol())) {
criteria.andProtocolEqualTo(node.getProtocol());
}
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}
@ -296,12 +292,9 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
ApiModuleExample example = new ApiModuleExample();
ApiModuleExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
.andProjectIdEqualTo(node.getProjectId())
.andLevelEqualTo(node.getLevel());
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}

View File

@ -233,12 +233,9 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
ApiScenarioModuleExample example = new ApiScenarioModuleExample();
ApiScenarioModuleExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
.andProjectIdEqualTo(node.getProjectId())
.andLevelEqualTo(node.getLevel());
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}
@ -321,12 +318,9 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
ApiScenarioModuleExample example = new ApiScenarioModuleExample();
ApiScenarioModuleExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
.andProjectIdEqualTo(node.getProjectId())
.andLevelEqualTo(node.getLevel());
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}

View File

@ -93,12 +93,9 @@ public class BaseModuleService extends NodeTreeService<ModuleNodeDTO> {
TestCaseNodeExample example = new TestCaseNodeExample();
TestCaseNodeExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
.andProjectIdEqualTo(node.getProjectId())
.andLevelEqualTo(node.getLevel());
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}
@ -575,12 +572,9 @@ public class BaseModuleService extends NodeTreeService<ModuleNodeDTO> {
TestCaseNodeExample example = new TestCaseNodeExample();
TestCaseNodeExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
.andProjectIdEqualTo(node.getProjectId())
.andLevelEqualTo(node.getLevel());
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}

View File

@ -104,12 +104,9 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
TestCaseNodeExample example = new TestCaseNodeExample();
TestCaseNodeExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName())
.andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotBlank(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
.andProjectIdEqualTo(node.getProjectId())
.andLevelEqualTo(node.getLevel());
if (StringUtils.isNotBlank(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}
@ -658,12 +655,10 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
if (module == null && StringUtils.isNotEmpty(node.getName())) {
TestCaseNodeExample example = new TestCaseNodeExample();
TestCaseNodeExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(node.getName()).andProjectIdEqualTo(node.getProjectId());
if (StringUtils.isNotEmpty(node.getParentId())) {
criteria.andParentIdEqualTo(node.getParentId());
} else {
criteria.andParentIdIsNull();
}
criteria.andNameEqualTo(node.getName()).
andProjectIdEqualTo(node.getProjectId())
.andLevelEqualTo(node.getLevel());
if (StringUtils.isNotEmpty(node.getId())) {
criteria.andIdNotEqualTo(node.getId());
}