From 4180d40a12d83c0962ff280c4bdab782a0e08ef2 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 5 Jun 2024 16:30:00 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GroupController.java | 14 ++++++------- system-setting/frontend/src/api/user-group.js | 20 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/system-setting/backend/src/main/java/io/metersphere/controller/GroupController.java b/system-setting/backend/src/main/java/io/metersphere/controller/GroupController.java index 8e7c30855a..793d055c03 100644 --- a/system-setting/backend/src/main/java/io/metersphere/controller/GroupController.java +++ b/system-setting/backend/src/main/java/io/metersphere/controller/GroupController.java @@ -14,21 +14,19 @@ import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.dto.GroupDTO; +import io.metersphere.dto.GroupPermissionDTO; +import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.annotation.MsRequestLog; import io.metersphere.request.GroupRequest; import io.metersphere.request.group.EditGroupRequest; import io.metersphere.request.group.EditGroupUserRequest; -import io.metersphere.dto.GroupDTO; -import io.metersphere.dto.GroupPermissionDTO; -import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.GroupService; -import org.apache.commons.lang3.StringUtils; +import jakarta.annotation.Resource; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; - import java.util.*; @@ -99,9 +97,9 @@ public class GroupController { groupService.editGroupPermission(editGroupRequest); } - @GetMapping("/all/{userId}") + @PostMapping("/all") @RequiresPermissions(PermissionConstants.SYSTEM_USER_READ_EDIT) - public List> getAllUserGroup(@PathVariable("userId") String userId) { + public List> getAllUserGroup(@RequestBody String userId) { return groupService.getAllUserGroup(userId); } diff --git a/system-setting/frontend/src/api/user-group.js b/system-setting/frontend/src/api/user-group.js index 8e9993ed79..5d9df7ecfd 100644 --- a/system-setting/frontend/src/api/user-group.js +++ b/system-setting/frontend/src/api/user-group.js @@ -1,4 +1,4 @@ -import {get, post} from 'metersphere-frontend/src/plugins/request'; +import { get, post } from "metersphere-frontend/src/plugins/request"; /** * param: {type: '', resourceId: ''} @@ -6,7 +6,7 @@ import {get, post} from 'metersphere-frontend/src/plugins/request'; * @returns {Promise | Promise} */ export function getUserGroupList(param) { - return post('/user/group/list', param); + return post("/user/group/list", param); } export function getWorkspaceMemberGroup(workspaceId, userId) { @@ -22,7 +22,7 @@ export function getUserGroupListByPage(goPage, pageSize, param) { } export function getAllUserGroupByType(param) { - return post('/user/group/get', param); + return post("/user/group/get", param); } export function getUserGroupsByTypeAndId(type, id) { @@ -38,19 +38,19 @@ export function delUserGroupById(groupId) { } export function getUserGroupPermission(param) { - return post('/user/group/permission', param); + return post("/user/group/permission", param); } export function modifyUserGroupPermission(param) { - return post('/user/group/permission/edit', param); + return post("/user/group/permission/edit", param); } export function createUserGroup(group) { - return post('/user/group/add', group); + return post("/user/group/add", group); } export function modifyUserGroup(group) { - return post('/user/group/edit', group); + return post("/user/group/edit", group); } export function getUserGroupByResourceUrlAndPage(url, goPage, pageSize, param) { @@ -62,7 +62,7 @@ export function getUserGroupSourceByUserIdAndGroupId(userId, groupId) { } export function modifyUserGroupMember(param) { - return post('/user/group/edit/member', param); + return post("/user/group/edit/member", param); } export function rmUserFromGroup(userId, groupId) { @@ -70,9 +70,9 @@ export function rmUserFromGroup(userId, groupId) { } export function addUser2Group(param) { - return post('/user/group/add/member', param); + return post("/user/group/add/member", param); } export function getUserAllGroups(userId) { - return get(`/user/group/all/${userId}`); + return post(`/user/group/all`, userId); }