|
|
@ -7,6 +7,7 @@ import cn.hutool.core.util.ArrayUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
|
|
import org.dromara.common.core.constant.UserConstants;
|
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
|
import org.dromara.common.core.domain.model.LoginUser;
|
|
|
|
import org.dromara.common.core.domain.model.LoginUser;
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
@ -22,6 +23,8 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
import org.dromara.common.tenant.helper.TenantHelper;
|
|
|
|
import org.dromara.common.tenant.helper.TenantHelper;
|
|
|
|
import org.dromara.common.web.core.BaseController;
|
|
|
|
import org.dromara.common.web.core.BaseController;
|
|
|
|
import org.dromara.system.domain.bo.SysDeptBo;
|
|
|
|
import org.dromara.system.domain.bo.SysDeptBo;
|
|
|
|
|
|
|
|
import org.dromara.system.domain.bo.SysPostBo;
|
|
|
|
|
|
|
|
import org.dromara.system.domain.bo.SysRoleBo;
|
|
|
|
import org.dromara.system.domain.bo.SysUserBo;
|
|
|
|
import org.dromara.system.domain.bo.SysUserBo;
|
|
|
|
import org.dromara.system.domain.vo.*;
|
|
|
|
import org.dromara.system.domain.vo.*;
|
|
|
|
import org.dromara.system.listener.SysUserImportListener;
|
|
|
|
import org.dromara.system.listener.SysUserImportListener;
|
|
|
@ -124,9 +127,13 @@ public class SysUserController extends BaseController {
|
|
|
|
public R<SysUserInfoVo> getInfo(@PathVariable(value = "userId", required = false) Long userId) {
|
|
|
|
public R<SysUserInfoVo> getInfo(@PathVariable(value = "userId", required = false) Long userId) {
|
|
|
|
userService.checkUserDataScope(userId);
|
|
|
|
userService.checkUserDataScope(userId);
|
|
|
|
SysUserInfoVo userInfoVo = new SysUserInfoVo();
|
|
|
|
SysUserInfoVo userInfoVo = new SysUserInfoVo();
|
|
|
|
List<SysRoleVo> roles = roleService.selectRoleAll();
|
|
|
|
SysRoleBo roleBo = new SysRoleBo();
|
|
|
|
|
|
|
|
roleBo.setStatus(UserConstants.ROLE_NORMAL);
|
|
|
|
|
|
|
|
SysPostBo postBo = new SysPostBo();
|
|
|
|
|
|
|
|
postBo.setStatus(UserConstants.POST_NORMAL);
|
|
|
|
|
|
|
|
List<SysRoleVo> roles = roleService.selectRoleList(roleBo);
|
|
|
|
userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin()));
|
|
|
|
userInfoVo.setRoles(LoginHelper.isSuperAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isSuperAdmin()));
|
|
|
|
userInfoVo.setPosts(postService.selectPostAll());
|
|
|
|
userInfoVo.setPosts(postService.selectPostList(postBo));
|
|
|
|
if (ObjectUtil.isNotNull(userId)) {
|
|
|
|
if (ObjectUtil.isNotNull(userId)) {
|
|
|
|
SysUserVo sysUser = userService.selectUserById(userId);
|
|
|
|
SysUserVo sysUser = userService.selectUserById(userId);
|
|
|
|
userInfoVo.setUser(sysUser);
|
|
|
|
userInfoVo.setUser(sysUser);
|
|
|
|