From 9b4b9e0c744f43417a3c8b741f35090ab4e3c68f Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期一, 15 三月 2021 16:38:43 +0800 Subject: [PATCH] update 删除通用工具 改为使用hutool --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java | 27 ++++++++++++--------------- 1 files changed, 12 insertions(+), 15 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 2271472..7375691 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,18 +1,10 @@ package com.ruoyi.system.service.impl; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; +import cn.hutool.core.lang.Validator; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.exception.CustomException; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.domain.SysRoleDept; import com.ruoyi.system.domain.SysRoleMenu; @@ -21,6 +13,11 @@ import com.ruoyi.system.mapper.SysRoleMenuMapper; import com.ruoyi.system.mapper.SysUserRoleMapper; import com.ruoyi.system.service.ISysRoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; /** * 瑙掕壊 涓氬姟灞傚鐞� @@ -68,7 +65,7 @@ Set<String> permsSet = new HashSet<>(); for (SysRole perm : perms) { - if (StringUtils.isNotNull(perm)) + if (Validator.isNotNull(perm)) { permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); } @@ -120,9 +117,9 @@ @Override public String checkRoleNameUnique(SysRole role) { - Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + Long roleId = Validator.isNull(role.getRoleId()) ? -1L : role.getRoleId(); SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); - if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) + if (Validator.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { return UserConstants.NOT_UNIQUE; } @@ -138,9 +135,9 @@ @Override public String checkRoleKeyUnique(SysRole role) { - Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + Long roleId = Validator.isNull(role.getRoleId()) ? -1L : role.getRoleId(); SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); - if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) + if (Validator.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { return UserConstants.NOT_UNIQUE; } @@ -155,7 +152,7 @@ @Override public void checkRoleAllowed(SysRole role) { - if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) + if (Validator.isNotNull(role.getRoleId()) && role.isAdmin()) { throw new CustomException("涓嶅厑璁告搷浣滆秴绾х鐞嗗憳瑙掕壊"); } -- Gitblit v1.9.3