From eeb6dd0a70ef0d483e0c0563143fc1b664add781 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 27 May 2020 14:42:54 +0800 Subject: [PATCH] =?UTF-8?q?bug=20fix=20=E7=A6=81=E7=94=A8=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8E=E4=BB=8D=E5=8F=AF=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/controller/UserController.java | 5 +++++ .../src/main/java/io/metersphere/service/UserService.java | 4 ---- frontend/src/business/components/settings/system/User.vue | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/UserController.java b/backend/src/main/java/io/metersphere/controller/UserController.java index 00a3e5fac7..50b1a34bc4 100644 --- a/backend/src/main/java/io/metersphere/controller/UserController.java +++ b/backend/src/main/java/io/metersphere/controller/UserController.java @@ -69,6 +69,11 @@ public class UserController { userService.updateUserRole(user); } + @PostMapping("/special/update_status") + public void updateStatus(@RequestBody User user) { + userService.updateUser(user); + } + @PostMapping("/special/ws/member/list/{goPage}/{pageSize}") @RequiresRoles(RoleConstants.ADMIN) public Pager> getMemberListByAdmin(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) { diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index 83424c9a50..71434fcd33 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -241,8 +241,6 @@ public class UserService { userRoleExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(request.getWorkspaceId()); List userRoles = userRoleMapper.selectByExample(userRoleExample); if (userRoles.size() > 0) { - User user = userMapper.selectByPrimaryKey(userId); - String username = user.getName(); MSException.throwException(Translator.get("user_already_exists")); } else { for (String roleId : request.getRoleIds()) { @@ -274,8 +272,6 @@ public class UserService { userRoleExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(request.getOrganizationId()); List userRoles = userRoleMapper.selectByExample(userRoleExample); if (userRoles.size() > 0) { - User user = userMapper.selectByPrimaryKey(userId); - String username = user.getName(); MSException.throwException(Translator.get("user_already_exists")); } else { for (String roleId : request.getRoleIds()) { diff --git a/frontend/src/business/components/settings/system/User.vue b/frontend/src/business/components/settings/system/User.vue index 51fe7b70bf..ea5e70ced2 100644 --- a/frontend/src/business/components/settings/system/User.vue +++ b/frontend/src/business/components/settings/system/User.vue @@ -489,7 +489,7 @@ this.btnAddRole = false; }, changeSwitch(row) { - this.$post(this.updatePath, row, () => { + this.$post('/user/special/update_status', row, () => { this.$success(this.$t('commons.modify_success')); }) },