feat:针对无数据时安全处理

This commit is contained in:
wangyu 2022-03-09 11:01:50 +08:00
parent 8c1f9d8a98
commit 752a3837f1
2 changed files with 8 additions and 4 deletions

View File

@ -20,10 +20,7 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
@ -117,6 +114,10 @@ public class DepartmentService extends BaseReactiveServiceImpl<Department> {
ids.add(qo.getAdditional());
qo.setIds(ids);
}
// qo中ids为空返回无效查询
if (CollectionUtils.isEmpty(qo.getIds())) {
qo.setIds(Collections.singleton("null"));
}
return mono;
}
}

View File

@ -93,6 +93,9 @@ public class RoleService extends BaseReactiveServiceImpl<Role> {
if (CollectionUtils.isNotEmpty(qo.getAdditions())) {
qo.getIds().addAll(qo.getAdditions());
}
if (CollectionUtils.isEmpty(qo.getIds())) {
return Flux.empty();
}
return super.getList(qo);
});
}