feat(fix):添加db数据集,默认加上数据源名称

This commit is contained in:
junjie 2021-06-02 11:59:33 +08:00
parent f837c0edf4
commit c2cb12c73b
2 changed files with 9 additions and 6 deletions

View File

@ -102,10 +102,6 @@ public class DataSetTableService {
datasetTable.setCreateBy(AuthUtils.getUser().getUsername()); datasetTable.setCreateBy(AuthUtils.getUser().getUsername());
datasetTable.setCreateTime(System.currentTimeMillis()); datasetTable.setCreateTime(System.currentTimeMillis());
DataTableInfoDTO dataTableInfoDTO = new DataTableInfoDTO(); DataTableInfoDTO dataTableInfoDTO = new DataTableInfoDTO();
if (StringUtils.equalsIgnoreCase("db", datasetTable.getType())) {
dataTableInfoDTO.setTable(datasetTable.getName());
datasetTable.setInfo(new Gson().toJson(dataTableInfoDTO));
}
int insert = datasetTableMapper.insert(datasetTable); int insert = datasetTableMapper.insert(datasetTable);
// 添加表成功后获取当前表字段和类型抽象到dataease数据库 // 添加表成功后获取当前表字段和类型抽象到dataease数据库
if (insert == 1) { if (insert == 1) {

View File

@ -120,17 +120,24 @@ export default {
save() { save() {
// console.log(this.checkTableList); // console.log(this.checkTableList);
// console.log(this.scene); // console.log(this.scene);
let ds = {}
this.options.forEach(ele => {
if (ele.id === this.dataSource) {
ds = ele
}
})
const sceneId = this.param.id const sceneId = this.param.id
const dataSourceId = this.dataSource const dataSourceId = this.dataSource
const tables = [] const tables = []
const mode = this.mode const mode = this.mode
this.checkTableList.forEach(function(name) { this.checkTableList.forEach(function(name) {
tables.push({ tables.push({
name: name, name: ds.name + '_' + name,
sceneId: sceneId, sceneId: sceneId,
dataSourceId: dataSourceId, dataSourceId: dataSourceId,
type: 'db', type: 'db',
mode: parseInt(mode) mode: parseInt(mode),
info: JSON.stringify({ table: name })
}) })
}) })
post('/dataset/table/batchAdd', tables).then(response => { post('/dataset/table/batchAdd', tables).then(response => {