From c82afc8c461956e45be0aa29ca2a7fe3f18ee6f7 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期二, 28 十二月 2021 11:23:33 +0800 Subject: [PATCH] update RedisUtils 迁移到 utils/redis 包下 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java | 39 ++++++++++++++++++++++----------------- 1 files changed, 22 insertions(+), 17 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..9ddb217 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 @@ -4,6 +4,7 @@ import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; @@ -16,8 +17,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; @@ -47,14 +47,14 @@ @ApiOperation("鏌ヨ瑙掕壊淇℃伅鍒楄〃") @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/list") - public TableDataInfo<SysRole> list(SysRole role) { - return roleService.selectPageRoleList(role); + public TableDataInfo<SysRole> list(SysRole role, PageQuery pageQuery) { + return roleService.selectPageRoleList(role, pageQuery); } @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 +66,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 +84,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 +102,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.setMenuPermissions(permissionService.getMenuPermission(sysUser)); tokenService.setLoginUser(loginUser); } return AjaxResult.success(); @@ -139,7 +137,6 @@ @PutMapping("/changeStatus") public AjaxResult<Void> changeStatus(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); - role.setUpdateBy(getUsername()); return toAjax(roleService.updateRoleStatus(role)); } @@ -150,7 +147,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)); } @@ -170,8 +167,8 @@ @ApiOperation("鏌ヨ宸插垎閰嶇敤鎴疯鑹插垪琛�") @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/allocatedList") - public TableDataInfo<SysUser> allocatedList(SysUser user) { - return userService.selectAllocatedList(user); + public TableDataInfo<SysUser> allocatedList(SysUser user, PageQuery pageQuery) { + return userService.selectAllocatedList(user, pageQuery); } /** @@ -180,8 +177,8 @@ @ApiOperation("鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛�") @PreAuthorize("@ss.hasPermi('system:role:list')") @GetMapping("/authUser/unallocatedList") - public TableDataInfo<SysUser> unallocatedList(SysUser user) { - return userService.selectUnallocatedList(user); + public TableDataInfo<SysUser> unallocatedList(SysUser user, PageQuery pageQuery) { + return userService.selectUnallocatedList(user, pageQuery); } /** @@ -199,6 +196,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 +211,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