diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.java index 2244d8e9ec..c45443638d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.java @@ -1,5 +1,6 @@ package io.metersphere.base.mapper.ext; +import io.metersphere.base.domain.Role; import io.metersphere.base.domain.User; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.organization.QueryOrgMemberRequest; @@ -19,5 +20,7 @@ public interface ExtUserRoleMapper { List getOrganizationMemberDTO(@Param("orgMember") QueryOrgMemberRequest request); + List getOrganizationMemberRoles(@Param("orgId") String orgId, @Param("userId") String userId); + } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.xml index 4bd2cff595..8b8363a306 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserRoleMapper.xml @@ -63,6 +63,14 @@ where o.id = #{orgMember.organizationId} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/controller/UserController.java b/backend/src/main/java/io/metersphere/controller/UserController.java index 0181c19e0d..82f6fb43e8 100644 --- a/backend/src/main/java/io/metersphere/controller/UserController.java +++ b/backend/src/main/java/io/metersphere/controller/UserController.java @@ -140,6 +140,9 @@ public class UserController { return PageUtils.setPageInfo(page, userService.getOrgMemberList(request)); } + /** + * 查询组织成员列表 带角色信息 + */ @PostMapping("/orgmemberdto/list/{goPage}/{pageSize}") public Pager> getOrganizationMemberDTO(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryOrgMemberRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); diff --git a/backend/src/main/java/io/metersphere/controller/UserRoleController.java b/backend/src/main/java/io/metersphere/controller/UserRoleController.java new file mode 100644 index 0000000000..ae0799abc5 --- /dev/null +++ b/backend/src/main/java/io/metersphere/controller/UserRoleController.java @@ -0,0 +1,23 @@ +package io.metersphere.controller; + +import io.metersphere.base.domain.Role; +import io.metersphere.service.UserRoleService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; +import java.util.List; + +@RequestMapping("userrole") +@RestController +public class UserRoleController { + + @Resource + private UserRoleService userRoleService; + + @GetMapping("/list/{orgId}/{userId}") + public List getOrganizationMemberRoles(@PathVariable String orgId, @PathVariable String userId) { + return userRoleService.getOrganizationMemberRoles(orgId, userId); + } +} diff --git a/backend/src/main/java/io/metersphere/service/UserRoleService.java b/backend/src/main/java/io/metersphere/service/UserRoleService.java new file mode 100644 index 0000000000..6e347790a4 --- /dev/null +++ b/backend/src/main/java/io/metersphere/service/UserRoleService.java @@ -0,0 +1,22 @@ +package io.metersphere.service; + +import io.metersphere.base.domain.Role; +import io.metersphere.base.mapper.ext.ExtUserRoleMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +@Service +@Transactional(rollbackFor = Exception.class) +public class UserRoleService { + + @Resource + private ExtUserRoleMapper extUserRoleMapper; + + public List getOrganizationMemberRoles(String orgId, String userId) { + return extUserRoleMapper.getOrganizationMemberRoles(orgId, userId); + } + +} diff --git a/frontend/src/performance/components/settings/OrganizationMember.vue b/frontend/src/performance/components/settings/OrganizationMember.vue index 93f1e6f912..8ae1f3a591 100644 --- a/frontend/src/performance/components/settings/OrganizationMember.vue +++ b/frontend/src/performance/components/settings/OrganizationMember.vue @@ -85,7 +85,7 @@ btnTips: "添加组织成员", createVisible: false, form: {}, - queryPath: "/user/orgmemberdto/list", + queryPath: "/user/orgmember/list", condition: "", tableData: [], rules: { @@ -111,8 +111,15 @@ }; this.result = this.$post(this.buildPagePath(this.queryPath), param, response => { let data = response.data; - this.total = data.itemCount; this.tableData = data.listObject; + let url = "/userrole/list/" + this.currentUser().lastOrganizationId; + for (let i = 0; i < this.tableData.length; i++) { + this.$get(url + "/" + this.tableData[i].id, response => { + let roles = response.data; + this.$set(this.tableData[i], "roles", roles); + }) + } + this.total = data.itemCount; }) }, buildPagePath(path) {