超管用户可获取所有角色

This commit is contained in:
张松
2025-11-08 14:17:15 +08:00
parent fedb72538e
commit dc4b2215b3

View File

@@ -71,7 +71,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
updateById(sysUser);
// 绑定角色
long roleCount = sysRoleMapper.selectCountByQuery(new QueryWrapper().eq(SysRole::getId, roleId).eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong()));
long roleCount = sysRoleMapper.selectCountByQuery(new QueryWrapper().eq(SysRole::getId, roleId).eq(SysRole::getCreateUserId, StpKit.USER.isAdmin() ? null : StpKit.USER.getLoginIdAsLong()));
if (roleCount == 0) {
throw new CzgException("角色不存在");
}