workspace list

This commit is contained in:
Captain.B 2020-02-11 15:51:59 +08:00
parent b09ffedbac
commit 7ca97ac14a
3 changed files with 20 additions and 11 deletions

View File

@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
@RequestMapping("workspace") @RequestMapping("workspace")
@RestController @RestController
@ -16,7 +17,12 @@ public class WorkspaceController {
private WorkspaceService workspaceService; private WorkspaceService workspaceService;
@PostMapping("add") @PostMapping("add")
public Workspace insertUser(@RequestBody Workspace workspace) { public Workspace addWorkspace(@RequestBody Workspace workspace) {
return workspaceService.add(workspace); return workspaceService.add(workspace);
} }
@PostMapping("list")
public List<Workspace> getWorkspaceList() {
return workspaceService.getWorkspaceList();
}
} }

View File

@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.UUID; import java.util.UUID;
@Service @Service
@ -31,4 +32,8 @@ public class WorkspaceService {
workspaceMapper.insertSelective(workspace); workspaceMapper.insertSelective(workspace);
return workspace; return workspace;
} }
public List<Workspace> getWorkspaceList() {
return workspaceMapper.selectByExample(null);
}
} }

View File

@ -5,16 +5,14 @@
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title">工作空间</span> <span class="title">工作空间</span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据ID名称搜索" prefix-icon="el-icon-search" <el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
maxlength="60" v-model="condition" clearable/> maxlength="60" v-model="condition" clearable/>
</span> </span>
</el-row> </el-row>
</div> </div>
<el-table :data="items" style="width: 100%"> <el-table :data="items" style="width: 100%">
<el-table-column prop="id" label="ID" width="180"/>
<el-table-column prop="name" label="名称"/> <el-table-column prop="name" label="名称"/>
<el-table-column prop="owner" label="创建者"/> <el-table-column prop="description" label="描述"/>
<el-table-column prop="enable" label="启用"/>
<el-table-column width="50"> <el-table-column width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle <el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle
@ -46,6 +44,11 @@
export default { export default {
name: "MsWorkspace", name: "MsWorkspace",
components: {MsCreateBox}, components: {MsCreateBox},
mounted() {
this.$post('/workspace/list', {}, response => {
this.items = response.data;
})
},
methods: { methods: {
create() { create() {
this.createVisible = true; this.createVisible = true;
@ -80,12 +83,7 @@
createVisible: false, createVisible: false,
btnTips: "添加工作空间", btnTips: "添加工作空间",
condition: "", condition: "",
items: [{ items: [],
id: '123456',
name: 'Default workspace',
owner: 'mk',
enable: "是"
}],
form: { form: {
// name: "", // name: "",
// description: "" // description: ""