From 0132219336357df461eb870197e9a99f1f25f016 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 26 Feb 2020 16:18:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=E7=AE=A1=E7=90=86=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=BB=84=E7=BB=87=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/ExtWorkspaceMapper.java | 10 ++++ .../base/mapper/ext/ExtWorkspaceMapper.xml | 10 ++++ .../controller/WorkspaceController.java | 3 +- .../java/io/metersphere/dto/WorkspaceDTO.java | 50 +++++++++++++++++++ .../metersphere/service/WorkspaceService.java | 8 ++- frontend/src/i18n/en_US.js | 1 + frontend/src/i18n/zh_CN.js | 1 + .../components/settings/SystemWorkspace.vue | 1 + 8 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml create mode 100644 backend/src/main/java/io/metersphere/dto/WorkspaceDTO.java diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java new file mode 100644 index 0000000000..538b463116 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java @@ -0,0 +1,10 @@ +package io.metersphere.base.mapper.ext; + +import io.metersphere.dto.WorkspaceDTO; + +import java.util.List; + +public interface ExtWorkspaceMapper { + + List getWorkspaceWithOrg(); +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml new file mode 100644 index 0000000000..a406d61bf1 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java index 6a1a5e2704..f2cb3287e0 100644 --- a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java +++ b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java @@ -7,6 +7,7 @@ import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.WorkspaceRequest; +import io.metersphere.dto.WorkspaceDTO; import io.metersphere.service.WorkspaceService; import io.metersphere.user.SessionUtils; import org.apache.shiro.authz.annotation.RequiresRoles; @@ -51,7 +52,7 @@ public class WorkspaceController { @PostMapping("list/all/{goPage}/{pageSize}") @RequiresRoles(RoleConstants.ORG_ADMIN) - public Pager> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) { + public Pager> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, workspaceService.getAllWorkspaceList()); } diff --git a/backend/src/main/java/io/metersphere/dto/WorkspaceDTO.java b/backend/src/main/java/io/metersphere/dto/WorkspaceDTO.java new file mode 100644 index 0000000000..49b72b78fc --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/WorkspaceDTO.java @@ -0,0 +1,50 @@ +package io.metersphere.dto; + +public class WorkspaceDTO { + + private String id; + private String name; + private String organizationId; + private String description; + private String organizationName; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getOrganizationId() { + return organizationId; + } + + public void setOrganizationId(String organizationId) { + this.organizationId = organizationId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOrganizationName() { + return organizationName; + } + + public void setOrganizationName(String organizationName) { + this.organizationName = organizationName; + } +} diff --git a/backend/src/main/java/io/metersphere/service/WorkspaceService.java b/backend/src/main/java/io/metersphere/service/WorkspaceService.java index b3a70a1a8c..1ea50bde38 100644 --- a/backend/src/main/java/io/metersphere/service/WorkspaceService.java +++ b/backend/src/main/java/io/metersphere/service/WorkspaceService.java @@ -4,10 +4,12 @@ import io.metersphere.base.domain.*; import io.metersphere.base.mapper.UserRoleMapper; import io.metersphere.base.mapper.WorkspaceMapper; import io.metersphere.base.mapper.ext.ExtUserRoleMapper; +import io.metersphere.base.mapper.ext.ExtWorkspaceMapper; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.exception.MSException; import io.metersphere.controller.request.WorkspaceRequest; import io.metersphere.dto.UserRoleHelpDTO; +import io.metersphere.dto.WorkspaceDTO; import io.metersphere.user.SessionUser; import io.metersphere.user.SessionUtils; import org.apache.commons.lang3.StringUtils; @@ -26,6 +28,8 @@ public class WorkspaceService { @Resource private WorkspaceMapper workspaceMapper; @Resource + private ExtWorkspaceMapper extWorkspaceMapper; + @Resource private ExtUserRoleMapper extUserRoleMapper; @Resource private UserRoleMapper userRoleMapper; @@ -69,8 +73,8 @@ public class WorkspaceService { return workspaceMapper.selectByExample(example); } - public List getAllWorkspaceList() { - return workspaceMapper.selectByExample(null); + public List getAllWorkspaceList() { + return extWorkspaceMapper.getWorkspaceWithOrg(); } public void deleteWorkspace(String workspaceId) { diff --git a/frontend/src/i18n/en_US.js b/frontend/src/i18n/en_US.js index a4578177cb..a43f3da859 100644 --- a/frontend/src/i18n/en_US.js +++ b/frontend/src/i18n/en_US.js @@ -17,6 +17,7 @@ const en_US = { 'input_name': 'Please enter a workspace name', 'input_name_2_50': '2 to 50 characters in length', 'search_by_name': 'Search by name', + 'organization_name': 'Organizationn Name' }, project: { 'recent': 'Recent Projects' diff --git a/frontend/src/i18n/zh_CN.js b/frontend/src/i18n/zh_CN.js index ea742402e0..ee0f7bd3c2 100644 --- a/frontend/src/i18n/zh_CN.js +++ b/frontend/src/i18n/zh_CN.js @@ -17,6 +17,7 @@ const zh_CN = { 'input_name': '请输入工作空间名称', 'input_name_2_50': '长度在 2 到 50 个字符', 'search_by_name': '根据名称搜索', + 'organization_name': '所属组织' }, project: { 'recent': '最近的项目' diff --git a/frontend/src/performance/components/settings/SystemWorkspace.vue b/frontend/src/performance/components/settings/SystemWorkspace.vue index 593435b76e..a114ec9fd9 100644 --- a/frontend/src/performance/components/settings/SystemWorkspace.vue +++ b/frontend/src/performance/components/settings/SystemWorkspace.vue @@ -17,6 +17,7 @@ +