|
|
@ -1,6 +1,7 @@
|
|
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
@ -21,6 +22,7 @@ import com.ruoyi.common.enums.BusinessType;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
|
|
|
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
|
|
|
import com.ruoyi.framework.util.ShiroUtils;
|
|
|
|
import com.ruoyi.framework.util.ShiroUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.system.domain.SysRole;
|
|
|
|
import com.ruoyi.system.domain.SysUser;
|
|
|
|
import com.ruoyi.system.domain.SysUser;
|
|
|
|
import com.ruoyi.system.domain.SysUserRole;
|
|
|
|
import com.ruoyi.system.domain.SysUserRole;
|
|
|
|
import com.ruoyi.system.service.ISysPostService;
|
|
|
|
import com.ruoyi.system.service.ISysPostService;
|
|
|
@ -106,7 +108,7 @@ public class SysUserController extends BaseController
|
|
|
|
@GetMapping("/add")
|
|
|
|
@GetMapping("/add")
|
|
|
|
public String add(ModelMap mmap)
|
|
|
|
public String add(ModelMap mmap)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mmap.put("roles", roleService.selectRoleAll());
|
|
|
|
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
|
|
|
mmap.put("posts", postService.selectPostAll());
|
|
|
|
mmap.put("posts", postService.selectPostAll());
|
|
|
|
return prefix + "/add";
|
|
|
|
return prefix + "/add";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -144,8 +146,9 @@ public class SysUserController extends BaseController
|
|
|
|
@GetMapping("/edit/{userId}")
|
|
|
|
@GetMapping("/edit/{userId}")
|
|
|
|
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
|
|
|
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
|
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
|
|
mmap.put("roles", roleService.selectRolesByUserId(userId));
|
|
|
|
mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
|
|
|
mmap.put("posts", postService.selectPostsByUserId(userId));
|
|
|
|
mmap.put("posts", postService.selectPostsByUserId(userId));
|
|
|
|
return prefix + "/edit";
|
|
|
|
return prefix + "/edit";
|
|
|
|
}
|
|
|
|
}
|
|
|
|