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 javax.annotation.Resource;
import java.util.List;
@RequestMapping("workspace")
@RestController
@ -16,7 +17,12 @@ public class WorkspaceController {
private WorkspaceService workspaceService;
@PostMapping("add")
public Workspace insertUser(@RequestBody Workspace workspace) {
public Workspace addWorkspace(@RequestBody Workspace 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 javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@Service
@ -31,4 +32,8 @@ public class WorkspaceService {
workspaceMapper.insertSelective(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">
<span class="title">工作空间</span>
<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/>
</span>
</el-row>
</div>
<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="owner" label="创建者"/>
<el-table-column prop="enable" label="启用"/>
<el-table-column prop="description" label="描述"/>
<el-table-column width="50">
<template slot-scope="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle
@ -46,6 +44,11 @@
export default {
name: "MsWorkspace",
components: {MsCreateBox},
mounted() {
this.$post('/workspace/list', {}, response => {
this.items = response.data;
})
},
methods: {
create() {
this.createVisible = true;
@ -80,12 +83,7 @@
createVisible: false,
btnTips: "添加工作空间",
condition: "",
items: [{
id: '123456',
name: 'Default workspace',
owner: 'mk',
enable: "是"
}],
items: [],
form: {
// name: "",
// description: ""