feat(数据集): 关联数据集

This commit is contained in:
junjie 2021-12-02 16:40:14 +08:00
parent 408a796e74
commit 4a8bfefac4
2 changed files with 15 additions and 8 deletions

View File

@ -281,7 +281,7 @@ public class DataSetTableService {
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(dorisDatasource);
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(dorisDatasource.getType());
if (StringUtils.equalsIgnoreCase("custom", table.getType())) {
if (StringUtils.equalsIgnoreCase("custom", table.getType()) || StringUtils.equalsIgnoreCase("union", table.getType())) {
datasourceRequest.setQuery(ddlProvider.dropView(dorisTableName));
jdbcProvider.exec(datasourceRequest);
datasourceRequest.setQuery(ddlProvider.dropView(DorisTableUtils.dorisTmpName(dorisTableName)));
@ -1070,7 +1070,7 @@ public class DataSetTableService {
private Map<String, Object> getUnionSQLDoris(DataTableInfoDTO dataTableInfoDTO) {
List<UnionDTO> union = dataTableInfoDTO.getUnion();
// 所有选中的字段即select后的查询字段
Map<String, String[]> checkedInfo = new TreeMap<>();
Map<String, String[]> checkedInfo = new LinkedHashMap<>();
List<UnionParamDTO> unionList = new ArrayList<>();
List<DatasetTableField> checkedFields = new ArrayList<>();
String sql = "";
@ -1183,7 +1183,7 @@ public class DataSetTableService {
List<UnionDTO> union = dataTableInfoDTO.getUnion();
// 所有选中的字段即select后的查询字段
Map<String, String[]> checkedInfo = new TreeMap<>();
Map<String, String[]> checkedInfo = new LinkedHashMap<>();
List<UnionParamDTO> unionList = new ArrayList<>();
List<DatasetTableField> checkedFields = new ArrayList<>();
String sql = "";
@ -1272,12 +1272,12 @@ public class DataSetTableService {
UnionDTO unionDTO = childrenDs.get(i);
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(unionDTO.getCurrentDs().getId());
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
String tableId = unionDTO.getCurrentDs().getId();
if (ObjectUtils.isEmpty(datasetTable)) {
DEException.throwException(Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
}
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField());
if (CollectionUtils.isEmpty(fields)) {
DEException.throwException(Translator.get("i18n_cst_ds_tb_or_field_deleted") + String.format(":table id [%s]", tableId));
@ -1473,7 +1473,11 @@ public class DataSetTableService {
datasetTableField.setTableId(datasetTable.getId());
datasetTableField.setOriginName(filed.getFieldName());
datasetTableField.setName(filed.getRemarks());
datasetTableField.setDataeaseName(DorisTableUtils.columnName(filed.getFieldName()));
if (datasetTable.getMode() == 1 && StringUtils.equalsIgnoreCase("union", datasetTable.getType())) {
datasetTableField.setDataeaseName(filed.getFieldName());
} else {
datasetTableField.setDataeaseName(DorisTableUtils.columnName(filed.getFieldName()));
}
datasetTableField.setType(filed.getFieldType());
if (ObjectUtils.isEmpty(ds)) {
datasetTableField.setDeType(transFieldType(filed.getFieldType()));

View File

@ -2,11 +2,11 @@
<div v-if="unionParam.type" style="height:600px;">
<div class="field-style">
<div class="fields">
<p>{{ unionParam.parent.currentDs.name }}</p>
<p :title="unionParam.parent.currentDs.name">{{ unionParam.parent.currentDs.name }}</p>
<union-field-list :field-list="parentField" :node="unionParam.parent" @checkedFields="changeParentFields" />
</div>
<div class="fields">
<p>{{ unionParam.node.currentDs.name }}</p>
<p :title="unionParam.parent.currentDs.name">{{ unionParam.node.currentDs.name }}</p>
<union-field-list :field-list="nodeField" :node="unionParam.node" @checkedFields="changeNodeFields" />
</div>
</div>
@ -81,6 +81,9 @@ export default {
p{
font-size: 14px;
margin: 6px 0!important;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.el-divider--horizontal {
margin: 12px 0;