|
@@ -30,9 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -251,35 +249,24 @@ public class SysUserServiceImpl extends ServiceImpl<ISysUserMapper, SysUser> imp
|
|
|
|
|
|
@Override
|
|
|
public List<SysUser> getByRoleType(Integer roleType) {
|
|
|
- List<SysRole> roles = roleService.getByRoleType(roleType);
|
|
|
- if(roles == null || roles.size()<=0){
|
|
|
- return null;
|
|
|
- }
|
|
|
- List<Long> collect = roles.stream().map(SysRole::getId).collect(Collectors.toList());
|
|
|
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ List<Long> collect ;
|
|
|
+ if(roleType == null){
|
|
|
+ collect = Arrays.asList(2L,3L,4L,5L);
|
|
|
+ }else {
|
|
|
+ List<SysRole> roles = roleService.getByRoleType(roleType);
|
|
|
+ if(roles == null || roles.size()<=0){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ collect = roles.stream().map(SysRole::getId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if(collect.isEmpty()){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
wrapper.in(SysUser::getRoleId,collect);
|
|
|
return this.list(wrapper);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<SysUser> getByRoleType(Integer roleType,Boolean hasMe) {
|
|
|
- List<SysRole> roles = roleService.getByRoleType(roleType);
|
|
|
- if(roles == null || roles.size()<=0){
|
|
|
- return null;
|
|
|
- }
|
|
|
- List<Long> collect = roles.stream().map(SysRole::getId).collect(Collectors.toList());
|
|
|
- LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(SysUser::getRoleId,collect);
|
|
|
- List<SysUser> list = this.list(wrapper);
|
|
|
- if(hasMe){
|
|
|
- SysUser byId = sysUserService.getByManageId(Long.valueOf(StpUtil.getLoginId().toString()));
|
|
|
- List<Long> collect1 = list.stream().map(SysUser::getId).collect(Collectors.toList());
|
|
|
- if(!collect1.contains(byId.getId())){
|
|
|
- list.add(byId);
|
|
|
- }
|
|
|
- }
|
|
|
- return list;
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public Long getU8UserId() {
|