refactor(接口测试): 优化查询接口是否有mock数据的方法

This commit is contained in:
wxg0103 2022-12-21 10:27:00 +08:00 committed by wxg0103
parent 2d5b21f487
commit 1c73442c54
1 changed files with 3 additions and 4 deletions

View File

@ -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());