refactor(接口测试): 优化查询接口是否有mock数据的方法
This commit is contained in:
parent
2d5b21f487
commit
1c73442c54
|
@ -129,7 +129,9 @@ public class MockConfigService {
|
|||
|
||||
public MockConfigResponse genMockConfig(MockConfigRequest request) {
|
||||
MockConfigResponse returnRsp;
|
||||
|
||||
if (StringUtils.isEmpty(request.getId())) {
|
||||
return new MockConfigResponse(null, new ArrayList<>());
|
||||
}
|
||||
MockConfigExample example = new MockConfigExample();
|
||||
MockConfigExample.Criteria criteria = example.createCriteria();
|
||||
if (request.getId() != null) {
|
||||
|
@ -137,9 +139,6 @@ public class MockConfigService {
|
|||
}
|
||||
if (request.getApiId() != null) {
|
||||
criteria.andApiIdEqualTo(request.getApiId());
|
||||
} else if (StringUtils.isEmpty(request.getId())) {
|
||||
//todo 刚子有时间把这里优化下: 如果不满足什么条件需要直接返回的话,增加一个check,提前返回。 尽可能不要在逻辑中途返回。会很难维护。
|
||||
return new MockConfigResponse(null, new ArrayList<>());
|
||||
}
|
||||
if (request.getProjectId() != null) {
|
||||
criteria.andProjectIdEqualTo(request.getProjectId());
|
||||
|
|
Loading…
Reference in New Issue