|
@@ -18,12 +18,12 @@ import com.community.huiju.vo.ToUserVO;
|
18
|
18
|
import com.github.pagehelper.Page;
|
19
|
19
|
import com.github.pagehelper.PageHelper;
|
20
|
20
|
import lombok.extern.slf4j.Slf4j;
|
|
21
|
+import org.apache.commons.collections.CollectionUtils;
|
21
|
22
|
import org.apache.commons.lang.StringUtils;
|
22
|
23
|
import org.springframework.beans.BeanUtils;
|
23
|
24
|
import org.springframework.beans.factory.annotation.Autowired;
|
24
|
25
|
import org.springframework.stereotype.Service;
|
25
|
26
|
|
26
|
|
-import javax.security.auth.callback.TextOutputCallback;
|
27
|
27
|
import java.util.*;
|
28
|
28
|
|
29
|
29
|
@Service("iToUserServer")
|
|
@@ -87,10 +87,19 @@ public class ToUserServerImpl implements IToUserService {
|
87
|
87
|
ToUserVO toUserVO = new ToUserVO();
|
88
|
88
|
BeanUtils.copyProperties(toUser,toUserVO);
|
89
|
89
|
|
90
|
|
- List<ToSysRole> sysRoleList = toSysRoleMapper.selectRoleByUserId(userId);
|
91
|
|
- toUserVO.setRoles(sysRoleList);
|
92
|
|
- // 菜单权限
|
93
|
|
- toUserVO.setPermissionList(getPermission(userId));
|
|
90
|
+ List<ToSysRole> roleList = toSysRoleMapper.selectRoleByUserId(userId);
|
|
91
|
+ if (CollectionUtils.isNotEmpty(roleList)) {
|
|
92
|
+ List<ToSysRole> sysRoleList = toSysRoleMapper.selectRoleByUserId(userId);
|
|
93
|
+ toUserVO.setRoles(sysRoleList);
|
|
94
|
+ // 菜单权限
|
|
95
|
+ toUserVO.setPermissionList(getPermission(userId));
|
|
96
|
+ } else {
|
|
97
|
+ ToSysRole toSysRole = new ToSysRole();
|
|
98
|
+ toSysRole.setRoleName("没有角色");
|
|
99
|
+ toUserVO.setRoles(Arrays.asList(toSysRole));
|
|
100
|
+ // 菜单权限
|
|
101
|
+ toUserVO.setPermissionList(Collections.EMPTY_LIST);
|
|
102
|
+ }
|
94
|
103
|
response.addSuccess(toUserVO);
|
95
|
104
|
|
96
|
105
|
return response;
|