From 0c8f727bd89677feb4c08b781af72807f4bd143a Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期一, 24 一月 2022 13:03:42 +0800 Subject: [PATCH] update maven-jar-plugin 3.2.0 => 3.2.2 update maven-war-plugin 3.2.0 => 3.2.2 update maven-compiler-plugin 3.1 => 3.9.0 update hutool 5.7.18 => 5.7.20 update springboot-admin 2.6.0 => 2.6.2 update redisson 3.16.7 => 3.16.8 update qiniu 7.9.0 => 7.9.2 update aliyun 3.13.1 => 3.14.0 update qcloud 5.6.58 => 5.6.68 update minio 8.3.4 => 8.3.5 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java | 27 +++++++++++++-------------- 1 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 736b4e6..81b8d66 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -1,5 +1,7 @@ package com.ruoyi.system.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.constant.UserConstants; @@ -8,8 +10,7 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.LoginUtils; -import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.helper.LoginHelper; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.domain.SysRoleDept; import com.ruoyi.system.domain.SysRoleMenu; @@ -88,7 +89,7 @@ List<SysRole> perms = baseMapper.selectRolePermissionByUserId(userId); Set<String> permsSet = new HashSet<>(); for (SysRole perm : perms) { - if (StringUtils.isNotNull(perm)) { + if (ObjectUtil.isNotNull(perm)) { permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); } } @@ -135,11 +136,10 @@ */ @Override public String checkRoleNameUnique(SysRole role) { - Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); - boolean count = baseMapper.exists(new LambdaQueryWrapper<SysRole>() + boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysRole>() .eq(SysRole::getRoleName, role.getRoleName()) - .ne(SysRole::getRoleId, roleId)); - if (count) { + .ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId())); + if (exist) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -153,11 +153,10 @@ */ @Override public String checkRoleKeyUnique(SysRole role) { - Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); - boolean count = baseMapper.exists(new LambdaQueryWrapper<SysRole>() + boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysRole>() .eq(SysRole::getRoleKey, role.getRoleKey()) - .ne(SysRole::getRoleId, roleId)); - if (count) { + .ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId())); + if (exist) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -170,7 +169,7 @@ */ @Override public void checkRoleAllowed(SysRole role) { - if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) { + if (ObjectUtil.isNotNull(role.getRoleId()) && role.isAdmin()) { throw new ServiceException("涓嶅厑璁告搷浣滆秴绾х鐞嗗憳瑙掕壊"); } } @@ -182,11 +181,11 @@ */ @Override public void checkRoleDataScope(Long roleId) { - if (!SysUser.isAdmin(LoginUtils.getUserId())) { + if (!SysUser.isAdmin(LoginHelper.getUserId())) { SysRole role = new SysRole(); role.setRoleId(roleId); List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role); - if (StringUtils.isEmpty(roles)) { + if (CollUtil.isEmpty(roles)) { throw new ServiceException("娌℃湁鏉冮檺璁块棶瑙掕壊鏁版嵁锛�"); } } -- Gitblit v1.9.3