From 9f21dbbc5cc415bc6287ec8814dea95365e5b77e Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 6 Dec 2021 21:55:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=95=BF=E4=B8=BB=E9=94=AE?= =?UTF-8?q?=E6=BA=A2=E5=87=BA=E9=97=AE=E9=A2=98=20=E5=B0=86=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=BF=94=E5=9B=9E=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=20Long?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/system/mapper/SysConfigMapper.java | 1 - .../com/ruoyi/system/mapper/SysDeptMapper.java | 4 +--- .../com/ruoyi/system/mapper/SysMenuMapper.java | 6 ++--- .../com/ruoyi/system/mapper/SysNoticeMapper.java | 1 - .../com/ruoyi/system/mapper/SysOperLogMapper.java | 1 - .../com/ruoyi/system/mapper/SysPostMapper.java | 3 +-- .../com/ruoyi/system/mapper/SysRoleDeptMapper.java | 1 - .../com/ruoyi/system/mapper/SysRoleMapper.java | 1 - .../com/ruoyi/system/mapper/SysRoleMenuMapper.java | 1 - .../com/ruoyi/system/mapper/SysUserMapper.java | 1 + .../com/ruoyi/system/mapper/SysUserPostMapper.java | 1 - .../com/ruoyi/system/mapper/SysUserRoleMapper.java | 2 -- .../ruoyi/system/service/ISysConfigService.java | 1 - .../com/ruoyi/system/service/ISysDeptService.java | 3 +-- .../com/ruoyi/system/service/ISysMenuService.java | 3 +-- .../ruoyi/system/service/ISysNoticeService.java | 1 - .../com/ruoyi/system/service/ISysPostService.java | 3 +-- .../com/ruoyi/system/service/ISysRoleService.java | 1 + .../com/ruoyi/system/service/ISysUserService.java | 2 +- .../system/service/impl/SysDeptServiceImpl.java | 2 +- .../system/service/impl/SysMenuServiceImpl.java | 17 +++++++++++--- .../system/service/impl/SysNoticeServiceImpl.java | 2 -- .../service/impl/SysPermissionServiceImpl.java | 1 - .../system/service/impl/SysPostServiceImpl.java | 4 +--- .../system/service/impl/SysUserServiceImpl.java | 26 ++++++++-------------- 25 files changed, 35 insertions(+), 54 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java index 2b1219d..71a0bce 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; - import com.ruoyi.system.domain.SysConfig; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index 980fc89..803b879 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -1,9 +1,7 @@ package com.ruoyi.system.mapper; import java.util.List; - import org.apache.ibatis.annotations.Param; - import com.ruoyi.system.api.domain.SysDept; /** @@ -28,7 +26,7 @@ public interface SysDeptMapper * @param deptCheckStrictly 部门树选择项是否关联显示 * @return 选中部门列表 */ - public List selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); + public List selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); /** * 根据部门ID查询信息 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java index d1ef73e..8a141a4 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java @@ -1,9 +1,7 @@ package com.ruoyi.system.mapper; import java.util.List; - import org.apache.ibatis.annotations.Param; - import com.ruoyi.system.domain.SysMenu; /** @@ -54,7 +52,7 @@ public interface SysMenuMapper /** * 根据用户ID查询菜单 * - * @param username 用户ID + * @param userId 用户ID * @return 菜单列表 */ public List selectMenuTreeByUserId(Long userId); @@ -66,7 +64,7 @@ public interface SysMenuMapper * @param menuCheckStrictly 菜单树选择项是否关联显示 * @return 选中菜单列表 */ - public List selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); + public List selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); /** * 根据菜单ID查询信息 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java index 5e801ea..ec8700d 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; - import com.ruoyi.system.domain.SysNotice; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java index 5503632..4e9b8cb 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; - import com.ruoyi.system.api.domain.SysOperLog; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java index 8180998..8603d9a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; - import com.ruoyi.system.domain.SysPost; /** @@ -40,7 +39,7 @@ public interface SysPostMapper * @param userId 用户ID * @return 选中岗位ID列表 */ - public List selectPostListByUserId(Long userId); + public List selectPostListByUserId(Long userId); /** * 查询用户所属岗位组 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java index 7946548..a4ad4de 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; - import com.ruoyi.system.domain.SysRoleDept; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java index a22f93d..b49511c 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; - import com.ruoyi.system.api.domain.SysRole; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java index e11419f..2339155 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; - import com.ruoyi.system.domain.SysRoleMenu; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java index 825be74..a7ffdb5 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -18,6 +18,7 @@ public interface SysUserMapper * @return 用户信息集合信息 */ public List selectUserList(SysUser sysUser); + /** * 根据条件分页查询未已配用户角色列表 * diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java index 8d50b04..9c33e54 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.system.mapper; import java.util.List; - import com.ruoyi.system.domain.SysUserPost; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java index 9bce2a0..ad3fe62 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java @@ -1,9 +1,7 @@ package com.ruoyi.system.mapper; import java.util.List; - import org.apache.ibatis.annotations.Param; - import com.ruoyi.system.domain.SysUserRole; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java index 695c9bd..6b6842f 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java @@ -1,7 +1,6 @@ package com.ruoyi.system.service; import java.util.List; - import com.ruoyi.system.domain.SysConfig; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java index ebdfbe4..ed1f611 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java @@ -1,7 +1,6 @@ package com.ruoyi.system.service; import java.util.List; - import com.ruoyi.system.api.domain.SysDept; import com.ruoyi.system.domain.vo.TreeSelect; @@ -42,7 +41,7 @@ public interface ISysDeptService * @param roleId 角色ID * @return 选中部门列表 */ - public List selectDeptListByRoleId(Long roleId); + public List selectDeptListByRoleId(Long roleId); /** * 根据部门ID查询信息 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java index 96af00e..9c4daf4 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java @@ -2,7 +2,6 @@ package com.ruoyi.system.service; import java.util.List; import java.util.Set; - import com.ruoyi.system.domain.SysMenu; import com.ruoyi.system.domain.vo.RouterVo; import com.ruoyi.system.domain.vo.TreeSelect; @@ -53,7 +52,7 @@ public interface ISysMenuService * @param roleId 角色ID * @return 选中菜单列表 */ - public List selectMenuListByRoleId(Long roleId); + public List selectMenuListByRoleId(Long roleId); /** * 构建前端路由所需要的菜单 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java index 37c6b45..fb1e420 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java @@ -1,7 +1,6 @@ package com.ruoyi.system.service; import java.util.List; - import com.ruoyi.system.domain.SysNotice; /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java index 626fe05..c7c3fc3 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java @@ -1,7 +1,6 @@ package com.ruoyi.system.service; import java.util.List; - import com.ruoyi.system.domain.SysPost; /** @@ -40,7 +39,7 @@ public interface ISysPostService * @param userId 用户ID * @return 选中岗位ID列表 */ - public List selectPostListByUserId(Long userId); + public List selectPostListByUserId(Long userId); /** * 校验岗位名称 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java index 9318ed2..d1b45ac 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java @@ -144,6 +144,7 @@ public interface ISysRoleService * @return 结果 */ public int deleteRoleByIds(Long[] roleIds); + /** * 取消授权用户角色 * diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java index f896268..1fc220a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java @@ -127,7 +127,7 @@ public interface ISysUserService * @return 结果 */ public int updateUser(SysUser user); - + /** * 用户授权角色 * diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 914df81..d8db7e8 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -100,7 +100,7 @@ public class SysDeptServiceImpl implements ISysDeptService * @return 选中部门列表 */ @Override - public List selectDeptListByRoleId(Long roleId) + public List selectDeptListByRoleId(Long roleId) { SysRole role = roleMapper.selectRoleById(roleId); return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly()); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 3f77cf2..d74ff8d 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -128,7 +128,7 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 选中菜单列表 */ @Override - public List selectMenuListByRoleId(Long roleId) + public List selectMenuListByRoleId(Long roleId) { SysRole role = roleMapper.selectRoleById(roleId); return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); @@ -179,7 +179,7 @@ public class SysMenuServiceImpl implements ISysMenuService router.setPath("/inner"); List childrenList = new ArrayList(); RouterVo children = new RouterVo(); - String routerPath = StringUtils.replaceEach(menu.getPath(), new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); + String routerPath = innerLinkReplaceEach(menu.getPath()); children.setPath(routerPath); children.setComponent(UserConstants.INNER_LINK); children.setName(StringUtils.capitalize(routerPath)); @@ -358,7 +358,7 @@ public class SysMenuServiceImpl implements ISysMenuService // 内链打开外网方式 if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { - routerPath = StringUtils.replaceEach(routerPath, new String[] { Constants.HTTP, Constants.HTTPS }, new String[] { "", "" }); + routerPath = innerLinkReplaceEach(routerPath); } // 非外链并且是一级目录(类型为目录) if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) @@ -500,4 +500,15 @@ public class SysMenuServiceImpl implements ISysMenuService { return getChildList(list, t).size() > 0 ? true : false; } + + /** + * 内链域名特殊字符替换 + * + * @return + */ + public String innerLinkReplaceEach(String path) + { + return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS }, + new String[] { "", "" }); + } } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java index 1ffef6b..8bebd9c 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java @@ -1,10 +1,8 @@ package com.ruoyi.system.service.impl; import java.util.List; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.mapper.SysNoticeMapper; import com.ruoyi.system.service.ISysNoticeService; diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPermissionServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPermissionServiceImpl.java index 47f4961..46a8c7a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPermissionServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPermissionServiceImpl.java @@ -4,7 +4,6 @@ import java.util.HashSet; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysPermissionService; diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java index fcd7a67..b14ca4b 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java @@ -1,10 +1,8 @@ package com.ruoyi.system.service.impl; import java.util.List; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - import com.ruoyi.common.core.constant.UserConstants; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.StringUtils; @@ -69,7 +67,7 @@ public class SysPostServiceImpl implements ISysPostService * @return 选中岗位ID列表 */ @Override - public List selectPostListByUserId(Long userId) + public List selectPostListByUserId(Long userId) { return postMapper.selectPostListByUserId(userId); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index c62959a..c397aa5 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -2,11 +2,13 @@ package com.ruoyi.system.service.impl; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import com.ruoyi.common.core.constant.UserConstants; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.SpringUtils; @@ -127,16 +129,11 @@ public class SysUserServiceImpl implements ISysUserService public String selectUserRoleGroup(String userName) { List list = roleMapper.selectRolesByUserName(userName); - StringBuffer idsStr = new StringBuffer(); - for (SysRole role : list) + if (CollectionUtils.isEmpty(list)) { - idsStr.append(role.getRoleName()).append(","); + return StringUtils.EMPTY; } - if (StringUtils.isNotEmpty(idsStr.toString())) - { - return idsStr.substring(0, idsStr.length() - 1); - } - return idsStr.toString(); + return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(",")); } /** @@ -149,16 +146,11 @@ public class SysUserServiceImpl implements ISysUserService public String selectUserPostGroup(String userName) { List list = postMapper.selectPostsByUserName(userName); - StringBuffer idsStr = new StringBuffer(); - for (SysPost post : list) + if (CollectionUtils.isEmpty(list)) { - idsStr.append(post.getPostName()).append(","); + return StringUtils.EMPTY; } - if (StringUtils.isNotEmpty(idsStr.toString())) - { - return idsStr.substring(0, idsStr.length() - 1); - } - return idsStr.toString(); + return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); } /** @@ -179,7 +171,7 @@ public class SysUserServiceImpl implements ISysUserService } /** - * 校验用户名称是否唯一 + * 校验手机号码是否唯一 * * @param user 用户信息 * @return