Spring Boot依赖升级后,Sort的设置方式调整。由 new Sort()改为 Sort.by()

pull/595/head
lWoHvYe 2021-02-13 10:38:55 +08:00
parent 5c47c331fc
commit 4a8707d6ca
3 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public class DeptServiceImpl implements DeptService {
@Override @Override
public List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception { public List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception {
Sort sort = new Sort(Sort.Direction.ASC, "deptSort"); Sort sort = Sort.by(Sort.Direction.ASC, "deptSort");
String dataScopeType = SecurityUtils.getDataScopeType(); String dataScopeType = SecurityUtils.getDataScopeType();
if (isQuery) { if (isQuery) {
if(dataScopeType.equals(DataScopeEnum.ALL.getValue())){ if(dataScopeType.equals(DataScopeEnum.ALL.getValue())){
@ -278,4 +278,4 @@ public class DeptServiceImpl implements DeptService {
redisUtils.delByKeys(CacheKey.DATA_USER, users.stream().map(User::getId).collect(Collectors.toSet())); redisUtils.delByKeys(CacheKey.DATA_USER, users.stream().map(User::getId).collect(Collectors.toSet()));
redisUtils.del(CacheKey.DEPT_ID + id); redisUtils.del(CacheKey.DEPT_ID + id);
} }
} }

View File

@ -61,7 +61,7 @@ public class MenuServiceImpl implements MenuService {
@Override @Override
public List<MenuDto> queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception { public List<MenuDto> queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception {
Sort sort = new Sort(Sort.Direction.ASC, "menuSort"); Sort sort = Sort.by(Sort.Direction.ASC, "menuSort");
if(isQuery){ if(isQuery){
criteria.setPidIsNull(true); criteria.setPidIsNull(true);
List<Field> fields = QueryHelp.getAllFields(criteria.getClass(), new ArrayList<>()); List<Field> fields = QueryHelp.getAllFields(criteria.getClass(), new ArrayList<>());

View File

@ -66,7 +66,7 @@ public class RoleServiceImpl implements RoleService {
@Override @Override
public List<RoleDto> queryAll() { public List<RoleDto> queryAll() {
Sort sort = new Sort(Sort.Direction.ASC, "level"); Sort sort = Sort.by(Sort.Direction.ASC, "level");
return roleMapper.toDto(roleRepository.findAll(sort)); return roleMapper.toDto(roleRepository.findAll(sort));
} }