|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.ruoyi.project.system.controller; |
|
|
|
package com.ruoyi.project.system.controller; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
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.controller.BaseController; |
|
|
|
import com.ruoyi.framework.web.domain.AjaxResult; |
|
|
|
import com.ruoyi.framework.web.domain.AjaxResult; |
|
|
|
import com.ruoyi.framework.web.page.TableDataInfo; |
|
|
|
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.domain.SysUser; |
|
|
|
import com.ruoyi.project.system.service.ISysPostService; |
|
|
|
import com.ruoyi.project.system.service.ISysPostService; |
|
|
|
import com.ruoyi.project.system.service.ISysRoleService; |
|
|
|
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) |
|
|
|
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AjaxResult ajax = AjaxResult.success(); |
|
|
|
AjaxResult ajax = AjaxResult.success(); |
|
|
|
ajax.put("roles", roleService.selectRoleAll()); |
|
|
|
List<SysRole> roles = roleService.selectRoleAll(); |
|
|
|
|
|
|
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
|
|
|
ajax.put("posts", postService.selectPostAll()); |
|
|
|
ajax.put("posts", postService.selectPostAll()); |
|
|
|
if (StringUtils.isNotNull(userId)) |
|
|
|
if (StringUtils.isNotNull(userId)) |
|
|
|
{ |
|
|
|
{ |
|
|
|