mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
add 新增 StringUtils splitTo 与 splitList 方法 优化业务代码
This commit is contained in:
@ -226,7 +226,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
||||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
|
||||
return baseMapper.insert(dept);
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
||||
SysDept newParentDept = baseMapper.selectById(dept.getParentId());
|
||||
SysDept oldDept = baseMapper.selectById(dept.getDeptId());
|
||||
if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(oldDept)) {
|
||||
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
|
||||
String newAncestors = newParentDept.getAncestors() + StringUtils.SEPARATOR + newParentDept.getDeptId();
|
||||
String oldAncestors = oldDept.getAncestors();
|
||||
dept.setAncestors(newAncestors);
|
||||
updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
|
||||
|
@ -92,7 +92,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms) {
|
||||
if (StringUtils.isNotEmpty(perm)) {
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||
permsSet.addAll(StringUtils.splitList(perm.trim()));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
@ -110,7 +110,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (String perm : perms) {
|
||||
if (StringUtils.isNotEmpty(perm)) {
|
||||
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||
permsSet.addAll(StringUtils.splitList(perm.trim()));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
|
@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
@ -15,6 +14,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.StreamUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SysRoleDept;
|
||||
import com.ruoyi.system.domain.SysRoleMenu;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
@ -107,7 +107,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (SysRole perm : perms) {
|
||||
if (ObjectUtil.isNotNull(perm)) {
|
||||
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
|
||||
permsSet.addAll(StringUtils.splitList(perm.getRoleKey().trim()));
|
||||
}
|
||||
}
|
||||
return permsSet;
|
||||
|
Reference in New Issue
Block a user