diff --git a/ruoyi/sql/ry_20200415.sql b/ruoyi/sql/ry_20200629.sql similarity index 98% rename from ruoyi/sql/ry_20200415.sql rename to ruoyi/sql/ry_20200629.sql index cf5124726..7c8e8c87a 100644 --- a/ruoyi/sql/ry_20200415.sql +++ b/ruoyi/sql/ry_20200629.sql @@ -120,8 +120,8 @@ create table sys_role ( -- ---------------------------- -- 初始化-角色信息表数据 -- ---------------------------- -insert into sys_role values('1', '管理员', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '管理员'); -insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色'); +insert into sys_role values('1', '系统管理员', 'admin', 1, 1, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '系统管理员'); +insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '普通角色'); -- ---------------------------- diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysUserController.java b/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysUserController.java index b93e8eb24..5c6857008 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysUserController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysUserController.java @@ -1,6 +1,7 @@ package com.ruoyi.project.system.controller; import java.util.List; +import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -25,6 +26,7 @@ import com.ruoyi.framework.security.service.TokenService; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.framework.web.page.TableDataInfo; +import com.ruoyi.project.system.domain.SysRole; import com.ruoyi.project.system.domain.SysUser; import com.ruoyi.project.system.service.ISysPostService; import com.ruoyi.project.system.service.ISysRoleService; @@ -101,7 +103,8 @@ public class SysUserController extends BaseController public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { AjaxResult ajax = AjaxResult.success(); - ajax.put("roles", roleService.selectRoleAll()); + List roles = roleService.selectRoleAll(); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("posts", postService.selectPostAll()); if (StringUtils.isNotNull(userId)) {