| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.ServletUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | |
| | |
|
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:role:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysRole role)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysRole role)
|
| | | {
|
| | | List<SysRole> list = roleService.selectRoleList(role);
|
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
| | | return util.exportExcel(list, "角色数据");
|
| | | util.exportExcel(response, list, "角色数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @GetMapping(value = "/{roleId}")
|
| | | public AjaxResult getInfo(@PathVariable Long roleId)
|
| | | {
|
| | | roleService.checkRoleDataScope(roleId);
|
| | | return AjaxResult.success(roleService.selectRoleById(roleId));
|
| | | }
|
| | |
|
| | |
| | | if (roleService.updateRole(role) > 0)
|
| | | {
|
| | | // 更新缓存用户权限
|
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
| | | LoginUser loginUser = getLoginUser();
|
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
| | | {
|
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|