From 25a1badbd0dbbdaeb6929264b86a49ad64e15b63 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 1 Mar 2022 15:09:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=E7=94=A8=E6=88=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=8E=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=A5=E5=8F=A3=E5=88=86=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/sys/SysUserController.java | 52 +++++++++---------- frontend/src/api/system/user.js | 10 ++++ .../src/views/panel/GrantAuth/user/index.vue | 8 +-- 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/sys/SysUserController.java b/backend/src/main/java/io/dataease/controller/sys/SysUserController.java index 933f720550..4c268c538b 100644 --- a/backend/src/main/java/io/dataease/controller/sys/SysUserController.java +++ b/backend/src/main/java/io/dataease/controller/sys/SysUserController.java @@ -1,6 +1,5 @@ package io.dataease.controller.sys; - import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.xiaoymin.knife4j.annotations.ApiSupport; @@ -49,27 +48,33 @@ public class SysUserController { @RequiresPermissions("user:read") @PostMapping("/userGrid/{goPage}/{pageSize}") @ApiImplicitParams({ - @ApiImplicitParam(paramType="path", name = "goPage", value = "页码", required = true, dataType = "Integer"), - @ApiImplicitParam(paramType="path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"), - @ApiImplicitParam(name = "request", value = "查询条件", required = true) + @ApiImplicitParam(paramType = "path", name = "goPage", value = "页码", required = true, dataType = "Integer"), + @ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "request", value = "查询条件", required = true) }) - public Pager> userGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) { + public Pager> userGrid(@PathVariable int goPage, @PathVariable int pageSize, + @RequestBody BaseGridRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, sysUserService.query(request)); } + @ApiIgnore + @PostMapping("/userLists") + public List userLists(@RequestBody BaseGridRequest request) { + return sysUserService.query(request); + } @ApiOperation("创建用户") @RequiresPermissions("user:add") @PostMapping("/create") - public void create(@RequestBody SysUserCreateRequest request){ + public void create(@RequestBody SysUserCreateRequest request) { sysUserService.save(request); } @ApiOperation("更新用户") @RequiresPermissions("user:edit") @PostMapping("/update") - public void update(@RequestBody SysUserCreateRequest request){ + public void update(@RequestBody SysUserCreateRequest request) { sysUserService.update(request); } @@ -77,33 +82,32 @@ public class SysUserController { @RequiresPermissions("user:del") @PostMapping("/delete/{userId}") @ApiImplicitParam(paramType = "path", value = "用户ID", name = "userId", required = true, dataType = "Integer") - public void delete(@PathVariable("userId") Long userId){ + public void delete(@PathVariable("userId") Long userId) { sysUserService.delete(userId); } - @ApiOperation("更新用户状态") @RequiresPermissions("user:edit") @RequiresRoles("1") @PostMapping("/updateStatus") - public void updateStatus(@RequestBody SysUserStateRequest request){ + public void updateStatus(@RequestBody SysUserStateRequest request) { sysUserService.updateStatus(request); } @ApiOperation("更新当前用户密码") @PostMapping("/updatePwd") - public void updatePwd(@RequestBody SysUserPwdRequest request){ + public void updatePwd(@RequestBody SysUserPwdRequest request) { sysUserService.updatePwd(request); } + @ApiOperation("更新指定用户密码") @RequiresPermissions("user:editPwd") @PostMapping("/adminUpdatePwd") - public void adminUpdatePwd(@RequestBody SysUserPwdRequest request){ + public void adminUpdatePwd(@RequestBody SysUserPwdRequest request) { sysUserService.adminUpdatePwd(request); } - @ApiOperation("当前用户信息") @PostMapping("/personInfo") public CurrentUserDto personInfo() { @@ -114,13 +118,13 @@ public class SysUserController { @ApiIgnore @ApiOperation("更新个人信息") @PostMapping("/updatePersonInfo") - public void updatePersonInfo(@RequestBody SysUserCreateRequest request){ + public void updatePersonInfo(@RequestBody SysUserCreateRequest request) { sysUserService.updatePersonInfo(request); } @ApiOperation("设置语言") @PostMapping("/setLanguage/{language}") - @ApiImplicitParam(paramType="path", name = "language", value = "语言(zh_CN, zh_TW, en_US)", required = true, dataType = "String") + @ApiImplicitParam(paramType = "path", name = "language", value = "语言(zh_CN, zh_TW, en_US)", required = true, dataType = "String") public void setLanguage(@PathVariable String language) { CurrentUserDto user = AuthUtils.getUser(); Optional.ofNullable(language).ifPresent(currentLanguage -> { @@ -132,28 +136,24 @@ public class SysUserController { @ApiOperation("查询所有角色") @PostMapping("/all") - public List all(){ + public List all() { return sysRoleService.allRoles(); } - - - @ApiOperation("查询角色") + @ApiIgnore("查询角色") @PostMapping("/roleGrid/{goPage}/{pageSize}") @ApiImplicitParams({ - @ApiImplicitParam(paramType="path", name = "goPage", value = "页码", required = true, dataType = "Integer"), - @ApiImplicitParam(paramType="path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"), - @ApiImplicitParam(name = "request", value = "查询条件", required = true) + @ApiImplicitParam(paramType = "path", name = "goPage", value = "页码", required = true, dataType = "Integer"), + @ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "request", value = "查询条件", required = true) }) - public Pager> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) { + public Pager> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, + @RequestBody BaseGridRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); Pager> listPager = PageUtils.setPageInfo(page, sysRoleService.query(request)); return listPager; } - - - @ApiOperation("已同步用户") @PostMapping("/existLdapUsers") public List getExistLdapUsers() { diff --git a/frontend/src/api/system/user.js b/frontend/src/api/system/user.js index 64d7d65f05..63cacd59ad 100644 --- a/frontend/src/api/system/user.js +++ b/frontend/src/api/system/user.js @@ -4,6 +4,7 @@ const pathMap = { personInfoPath: '/api/user/personInfo/', piupdatePath: '/api/user/updatePersonInfo/', queryPath: '/api/user/userGrid/', + queryWithOutPagePath: '/api/user/userLists', deletePath: '/api/user/delete/', createPath: '/api/user/create', updatePath: '/api/user/update', @@ -19,6 +20,15 @@ export function userLists(page, size, data) { }) } +export function userListsWithOutPage(data) { + return request({ + url: pathMap.queryWithOutPagePath, + method: 'post', + data, + loading: true + }) +} + export const addUser = (data) => { return request({ url: pathMap.createPath, diff --git a/frontend/src/views/panel/GrantAuth/user/index.vue b/frontend/src/views/panel/GrantAuth/user/index.vue index 452ea0437d..6dc1d2c6a0 100644 --- a/frontend/src/views/panel/GrantAuth/user/index.vue +++ b/frontend/src/views/panel/GrantAuth/user/index.vue @@ -24,7 +24,7 @@