系统管理员工作空间管理增加组织列

This commit is contained in:
shiziyuan9527 2020-02-26 16:18:12 +08:00
parent 947a5db82e
commit 0132219336
8 changed files with 81 additions and 3 deletions

View File

@ -0,0 +1,10 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.dto.WorkspaceDTO;
import java.util.List;
public interface ExtWorkspaceMapper {
List<WorkspaceDTO> getWorkspaceWithOrg();
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.metersphere.base.mapper.ext.ExtWorkspaceMapper">
<select id="getWorkspaceWithOrg" resultType="io.metersphere.dto.WorkspaceDTO">
select w.id, w.name, w.organization_id as organizationId, w.description, o.name as organizationName
from workspace w join organization o on w.organization_id = o.id
</select>
</mapper>

View File

@ -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<List<Workspace>> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) {
public Pager<List<WorkspaceDTO>> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, workspaceService.getAllWorkspaceList());
}

View File

@ -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;
}
}

View File

@ -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<Workspace> getAllWorkspaceList() {
return workspaceMapper.selectByExample(null);
public List<WorkspaceDTO> getAllWorkspaceList() {
return extWorkspaceMapper.getWorkspaceWithOrg();
}
public void deleteWorkspace(String workspaceId) {

View File

@ -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'

View File

@ -17,6 +17,7 @@ const zh_CN = {
'input_name': '请输入工作空间名称',
'input_name_2_50': '长度在 2 到 50 个字符',
'search_by_name': '根据名称搜索',
'organization_name': '所属组织'
},
project: {
'recent': '最近的项目'

View File

@ -17,6 +17,7 @@
<el-table :data="items" style="width: 100%">
<el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column prop="organizationName" :label="$t('workspace.organization_name')"/>
<el-table-column>
<template slot-scope="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>