From af25588b88a727b6c945796e3cf34ed3d4f05e89 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期四, 25 十一月 2021 19:39:53 +0800 Subject: [PATCH] Merge remote-tracking branch 'ruoyi-vue/master' into dev --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index cd525c4..19cda5e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -16,8 +16,7 @@ import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.SysPermissionService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.*; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -54,7 +53,7 @@ @ApiOperation("瀵煎嚭瑙掕壊淇℃伅鍒楄〃") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:role:export')") - @GetMapping("/export") + @PostMapping("/export") public void export(SysRole role, HttpServletResponse response) { List<SysRole> list = roleService.selectRoleList(role); ExcelUtil.exportExcel(list, "瑙掕壊鏁版嵁", SysRole.class, response); @@ -66,7 +65,7 @@ @ApiOperation("鏍规嵁瑙掕壊缂栧彿鑾峰彇璇︾粏淇℃伅") @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping(value = "/{roleId}") - public AjaxResult<SysRole> getInfo(@PathVariable Long roleId) { + public AjaxResult<SysRole> getInfo(@ApiParam("瑙掕壊ID") @PathVariable Long roleId) { roleService.checkRoleDataScope(roleId); return AjaxResult.success(roleService.selectRoleById(roleId)); } @@ -84,7 +83,6 @@ } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { return AjaxResult.error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); } - role.setCreateBy(getUsername()); return toAjax(roleService.insertRole(role)); } @@ -103,14 +101,13 @@ } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { return AjaxResult.error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); } - role.setUpdateBy(getUsername()); if (roleService.updateRole(role) > 0) { // 鏇存柊缂撳瓨鐢ㄦ埛鏉冮檺 LoginUser loginUser = getLoginUser(); - if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) { - loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); - loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); + SysUser sysUser = userService.selectUserById(loginUser.getUserId()); + if (StringUtils.isNotNull(sysUser) && !sysUser.isAdmin()) { + loginUser.setPermissions(permissionService.getMenuPermission(sysUser)); tokenService.setLoginUser(loginUser); } return AjaxResult.success(); @@ -139,7 +136,6 @@ @PutMapping("/changeStatus") public AjaxResult<Void> changeStatus(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); - role.setUpdateBy(getUsername()); return toAjax(roleService.updateRoleStatus(role)); } @@ -150,7 +146,7 @@ @PreAuthorize("@ss.hasPermi('system:role:remove')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{roleIds}") - public AjaxResult<Void> remove(@PathVariable Long[] roleIds) { + public AjaxResult<Void> remove(@ApiParam("宀椾綅ID涓�") @PathVariable Long[] roleIds) { return toAjax(roleService.deleteRoleByIds(roleIds)); } @@ -199,6 +195,10 @@ * 鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛 */ @ApiOperation("鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleId", value = "瑙掕壊ID", paramType = "query", dataTypeClass = String.class), + @ApiImplicitParam(name = "userIds", value = "鐢ㄦ埛ID涓�", paramType = "query", dataTypeClass = String.class) + }) @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancelAll") @@ -210,6 +210,10 @@ * 鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈 */ @ApiOperation("鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roleId", value = "瑙掕壊ID", paramType = "query", dataTypeClass = String.class), + @ApiImplicitParam(name = "userIds", value = "鐢ㄦ埛ID涓�", paramType = "query", dataTypeClass = String.class) + }) @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/selectAll") -- Gitblit v1.9.3