mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-10-08 02:56:40 +08:00
Compare commits
2 Commits
ecd4e3eaf0
...
48213bc9c9
Author | SHA1 | Date | |
---|---|---|---|
|
48213bc9c9 | ||
|
3995d9699d |
@ -1,6 +1,7 @@
|
||||
package org.dromara.common.satoken.core.service;
|
||||
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.enums.UserType;
|
||||
@ -39,8 +40,12 @@ public class SaPermissionImpl implements StpInterface {
|
||||
if (userType == UserType.APP_USER) {
|
||||
// 其他端 自行根据业务编写
|
||||
}
|
||||
if (CollUtil.isNotEmpty(loginUser.getMenuPermission())) {
|
||||
// SYS_USER 默认返回权限
|
||||
return new ArrayList<>(loginUser.getMenuPermission());
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,8 +67,12 @@ public class SaPermissionImpl implements StpInterface {
|
||||
if (userType == UserType.APP_USER) {
|
||||
// 其他端 自行根据业务编写
|
||||
}
|
||||
if (CollUtil.isNotEmpty(loginUser.getRolePermission())) {
|
||||
// SYS_USER 默认返回权限
|
||||
return new ArrayList<>(loginUser.getRolePermission());
|
||||
return new ArrayList<>(loginUser.getMenuPermission());
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
private PermissionService getPermissionService() {
|
||||
|
@ -17,6 +17,7 @@ import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.bo.SysUserPasswordBo;
|
||||
import org.dromara.system.domain.bo.SysUserProfileBo;
|
||||
import org.dromara.system.domain.vo.ProfileUserVo;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
@ -50,7 +51,9 @@ public class SysProfileController extends BaseController {
|
||||
SysUserVo user = userService.selectUserById(LoginHelper.getUserId());
|
||||
String roleGroup = userService.selectUserRoleGroup(user.getUserId());
|
||||
String postGroup = userService.selectUserPostGroup(user.getUserId());
|
||||
ProfileVo profileVo = new ProfileVo(user, roleGroup, postGroup);
|
||||
// 单独做一个vo专门给个人中心用 避免数据被脱敏
|
||||
ProfileUserVo profileUser = BeanUtil.toBean(user, ProfileUserVo.class);
|
||||
ProfileVo profileVo = new ProfileVo(profileUser, roleGroup, postGroup);
|
||||
return R.ok(profileVo);
|
||||
}
|
||||
|
||||
@ -128,6 +131,6 @@ public class SysProfileController extends BaseController {
|
||||
|
||||
public record AvatarVo(String imgUrl) {}
|
||||
|
||||
public record ProfileVo(SysUserVo user, String roleGroup, String postGroup) {}
|
||||
public record ProfileVo(ProfileUserVo user, String roleGroup, String postGroup) {}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
package org.dromara.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 用户信息视图对象 sys_user
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Data
|
||||
public class ProfileUserVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户类型(sys_user系统用户)
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 用户性别(0男 1女 2未知)
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
@Translation(type = TransConstant.OSS_ID_TO_URL)
|
||||
private Long avatar;
|
||||
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
private String loginIp;
|
||||
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
private Date loginDate;
|
||||
|
||||
/**
|
||||
* 部门名
|
||||
*/
|
||||
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptId")
|
||||
private String deptName;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user