fix: 数据源更新记录

This commit is contained in:
taojinlong 2023-10-26 15:49:13 +08:00
parent c77e2f7983
commit 2a601cfdd6
4 changed files with 17 additions and 3 deletions

View File

@ -134,7 +134,7 @@ public class DatasourceSyncManage {
datasourceRequest.setDatasource(coreDatasource);
List<DatasetTableDTO> tables = ApiUtils.getTables(datasourceRequest);
for (DatasetTableDTO api : tables) {
CoreDatasourceTaskLog datasetTableTaskLog = datasourceTaskServer.initTaskLog(coreDatasource.getId(), taskId, api.getName(), scheduleType);
CoreDatasourceTaskLog datasetTableTaskLog = datasourceTaskServer.initTaskLog(coreDatasource.getId(), taskId, api.getTableName(), scheduleType);
datasourceRequest.setTable(api.getTableName());
List<TableField> tableFields = ApiUtils.getTableFields(datasourceRequest);
try {
@ -181,7 +181,7 @@ public class DatasourceSyncManage {
LogUtil.error("Can not find datasource: " + datasourceId);
return;
}
CoreDatasourceTaskLog datasetTableTaskLog = datasourceTaskServer.initTaskLog(datasourceId, null, name, MANUAL.toString());
CoreDatasourceTaskLog datasetTableTaskLog = datasourceTaskServer.initTaskLog(datasourceId, null, tableName, MANUAL.toString());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(coreDatasource);

View File

@ -846,11 +846,24 @@ public class DatasourceServer implements DatasourceApi {
}
public IPage<CoreDatasourceTaskLogDTO> listSyncRecord(int goPage, int pageSize, Long dsId) {
QueryWrapper<CoreDatasourceTaskLogDTO> wrapper = new QueryWrapper<>();
wrapper.eq("ds_id", dsId);
wrapper.orderByDesc("start_time");
Page<CoreDatasourceTaskLogDTO> page = new Page<>(goPage, pageSize);
IPage<CoreDatasourceTaskLogDTO> pager = taskLogExtMapper.pager(page, wrapper);
CoreDatasource coreDatasource = datasourceMapper.selectById(dsId);
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(coreDatasource);
List<DatasetTableDTO> datasetTableDTOS = ApiUtils.getTables(datasourceRequest);
for (int i = 0; i < pager.getRecords().size(); i++) {
for (int i1 = 0; i1 < datasetTableDTOS.size(); i1++) {
if(pager.getRecords().get(i).getTableName().equalsIgnoreCase(datasetTableDTOS.get(i1).getTableName())){
pager.getRecords().get(i).setName(datasetTableDTOS.get(i1).getName());
}
}
}
return pager;
}

View File

@ -1236,7 +1236,7 @@ onMounted(() => {
@size-change="handleRecordSizeChange"
@current-change="handleRecordCurrentChange"
>
<el-table-column prop="tableName" :label="t('datasource.data_table')"></el-table-column>
<el-table-column prop="name" :label="t('datasource.data_table')"></el-table-column>
<el-table-column prop="triggerType" :label="t('datasource.sync_rate')">
<template #default="scope">
<div class="flex-align-center">

View File

@ -55,6 +55,7 @@ public class CoreDatasourceTaskLogDTO implements Serializable {
*/
private String taskStatus;
private String tableName;
private String name;
/**
* 错误信息