forked from github/dataease
fix: 精简模式下创建关联数据集失败
This commit is contained in:
parent
8857c99564
commit
c493849d1a
@ -22,7 +22,7 @@ public class MysqlDDLProvider extends DDLProviderImpl {
|
||||
|
||||
@Override
|
||||
public String createView(String name, String viewSQL) {
|
||||
return "CREATE VIEW IF NOT EXISTS " + name + " AS (" + viewSQL + ")";
|
||||
return "CREATE or replace view " + name + " AS (" + viewSQL + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -962,7 +962,7 @@ public class DataSetTableService {
|
||||
} else {
|
||||
ds = engineService.getDeEngine();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
sql = getCustomSQLDoris(dataTableInfoDTO, list);
|
||||
sql = getCustomViewSQL(dataTableInfoDTO, list);
|
||||
}
|
||||
Map<String, Object> res = new HashMap<>();
|
||||
try {
|
||||
@ -1010,8 +1010,8 @@ public class DataSetTableService {
|
||||
}
|
||||
}
|
||||
|
||||
// 自助数据集从doris里预览数据
|
||||
private String getCustomSQLDoris(DataTableInfoDTO dataTableInfoDTO, List<DataSetTableUnionDTO> list) {
|
||||
// 自助数据集从数据引擎(dorsi/mysql/...)里预览数据
|
||||
private String getCustomViewSQL(DataTableInfoDTO dataTableInfoDTO, List<DataSetTableUnionDTO> list) {
|
||||
Map<String, String[]> customInfo = new TreeMap<>();
|
||||
dataTableInfoDTO.getList().forEach(ele -> {
|
||||
String table = TableUtils.tableName(ele.getTableId());
|
||||
@ -1519,7 +1519,7 @@ public class DataSetTableService {
|
||||
dataSetTableFieldsService.batchEdit(fieldList);
|
||||
// custom 创建doris视图
|
||||
if (datasetTable.getMode() == 1) {
|
||||
createDorisView(TableUtils.tableName(datasetTable.getId()), getCustomSQLDoris(dataTableInfoDTO,
|
||||
createDorisView(TableUtils.tableName(datasetTable.getId()), getCustomViewSQL(dataTableInfoDTO,
|
||||
dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId())));
|
||||
}
|
||||
return;
|
||||
@ -1670,11 +1670,11 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
private void createDorisView(String dorisTableName, String customSql) throws Exception {
|
||||
Datasource dorisDatasource = engineService.getDeEngine();
|
||||
Datasource engine = engineService.getDeEngine();
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(dorisDatasource);
|
||||
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(dorisDatasource.getType());
|
||||
datasourceRequest.setDatasource(engine);
|
||||
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(engine.getType());
|
||||
// 先删除表
|
||||
datasourceRequest.setQuery(ddlProvider.dropView(dorisTableName));
|
||||
jdbcProvider.exec(datasourceRequest);
|
||||
@ -2184,21 +2184,21 @@ public class DataSetTableService {
|
||||
private UtilMapper utilMapper;
|
||||
|
||||
public void updateDatasetTableStatus() {
|
||||
if(this.isUpdatingDatasetTableStatus){
|
||||
if (this.isUpdatingDatasetTableStatus) {
|
||||
return;
|
||||
}else {
|
||||
} else {
|
||||
this.isUpdatingDatasetTableStatus = true;
|
||||
}
|
||||
|
||||
try {
|
||||
doUpdate();
|
||||
}catch (Exception e){}
|
||||
finally {
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
this.isUpdatingDatasetTableStatus = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void doUpdate(){
|
||||
private void doUpdate() {
|
||||
List<QrtzSchedulerState> qrtzSchedulerStates = qrtzSchedulerStateMapper.selectByExample(null);
|
||||
List<String> activeQrtzInstances = qrtzSchedulerStates.stream()
|
||||
.filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime()
|
||||
@ -2250,6 +2250,7 @@ public class DataSetTableService {
|
||||
extractDataService.deleteFile("incremental_delete", jobStoppeddDatasetTable.getId());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 判断数组中是否有重复的值
|
||||
*/
|
||||
|
@ -115,6 +115,7 @@
|
||||
|
||||
<script>
|
||||
import { isKettleRunning, post } from '@/api/dataset/dataset'
|
||||
import {engineMode} from "@/api/system/engine";
|
||||
|
||||
export default {
|
||||
name: 'DatasetGroupSelector',
|
||||
@ -219,6 +220,9 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.kettleState()
|
||||
engineMode().then(res => {
|
||||
this.engineMode = res.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
filterNode(value, data) {
|
||||
@ -271,7 +275,7 @@ export default {
|
||||
return !(ele.mode === 0 && ele.type === 'sql')
|
||||
})
|
||||
for (let i = 0; i < this.tables.length; i++) {
|
||||
if (this.tables[i].mode === 1 && this.kettleRunning === false) {
|
||||
if (this.tables[i].mode === 1 && this.kettleRunning === false && this.engineMode !== 'simple' ) {
|
||||
this.$set(this.tables[i], 'disabled', true)
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ export default {
|
||||
sourceFieldOption: [],
|
||||
targetFieldOption: [],
|
||||
targetTable: {},
|
||||
customType: ['db', 'sql', 'excel']
|
||||
customType: ['db', 'sql', 'excel', 'api']
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -207,7 +207,7 @@ export default {
|
||||
if (this.table.mode === 0) {
|
||||
this.customType = ['db']
|
||||
} else {
|
||||
this.customType = ['db', 'sql', 'excel']
|
||||
this.customType = ['db', 'sql', 'excel', 'api']
|
||||
}
|
||||
post('dataset/union/listByTableId/' + this.table.id, {}).then(response => {
|
||||
// console.log(response)
|
||||
|
Loading…
Reference in New Issue
Block a user