From 610883b0db195e73d85add8caaf720d7f465431d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Tue, 27 Jun 2023 13:22:16 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=A7=92=E8=89=B2=E5=A6=82=E6=9E=9C=E6=9C=AA=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E7=94=A8=E6=88=B7=E5=88=99=E6=97=A0=E9=9C=80=E6=B8=85?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/dromara/system/service/impl/SysRoleServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysRoleServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysRoleServiceImpl.java index 415644af..5c14294c 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysRoleServiceImpl.java @@ -445,6 +445,11 @@ public class SysRoleServiceImpl implements ISysRoleService { @Override public void cleanOnlineUserByRole(Long roleId) { + // 如果角色未绑定用户 直接返回 + Long num = userRoleMapper.selectCount(new LambdaQueryWrapper().eq(SysUserRole::getRoleId, roleId)); + if (num == 0) { + return; + } List keys = StpUtil.searchTokenValue("", 0, -1, false); if (CollUtil.isEmpty(keys)) { return;