Skip to content

Commit 4a8bfef

Browse files
committed
feat(数据集): 关联数据集
1 parent 408a796 commit 4a8bfef

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private void deleteDorisTable(String datasetId, DatasetTable table) throws Excep
281281
DatasourceRequest datasourceRequest = new DatasourceRequest();
282282
datasourceRequest.setDatasource(dorisDatasource);
283283
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(dorisDatasource.getType());
284-
if (StringUtils.equalsIgnoreCase("custom", table.getType())) {
284+
if (StringUtils.equalsIgnoreCase("custom", table.getType()) || StringUtils.equalsIgnoreCase("union", table.getType())) {
285285
datasourceRequest.setQuery(ddlProvider.dropView(dorisTableName));
286286
jdbcProvider.exec(datasourceRequest);
287287
datasourceRequest.setQuery(ddlProvider.dropView(DorisTableUtils.dorisTmpName(dorisTableName)));
@@ -1070,7 +1070,7 @@ private String convertUnionTypeToSQL(String unionType) {
10701070
private Map<String, Object> getUnionSQLDoris(DataTableInfoDTO dataTableInfoDTO) {
10711071
List<UnionDTO> union = dataTableInfoDTO.getUnion();
10721072
// 所有选中的字段,即select后的查询字段
1073-
Map<String, String[]> checkedInfo = new TreeMap<>();
1073+
Map<String, String[]> checkedInfo = new LinkedHashMap<>();
10741074
List<UnionParamDTO> unionList = new ArrayList<>();
10751075
List<DatasetTableField> checkedFields = new ArrayList<>();
10761076
String sql = "";
@@ -1183,7 +1183,7 @@ public Map<String, Object> getUnionSQLDatasource(DataTableInfoDTO dataTableInfoD
11831183

11841184
List<UnionDTO> union = dataTableInfoDTO.getUnion();
11851185
// 所有选中的字段,即select后的查询字段
1186-
Map<String, String[]> checkedInfo = new TreeMap<>();
1186+
Map<String, String[]> checkedInfo = new LinkedHashMap<>();
11871187
List<UnionParamDTO> unionList = new ArrayList<>();
11881188
List<DatasetTableField> checkedFields = new ArrayList<>();
11891189
String sql = "";
@@ -1272,12 +1272,12 @@ private void getUnionSQLDatasourceJoin(List<UnionDTO> childrenDs, Map<String, St
12721272
UnionDTO unionDTO = childrenDs.get(i);
12731273

12741274
DatasetTable datasetTable = datasetTableMapper.selectByPrimaryKey(unionDTO.getCurrentDs().getId());
1275-
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
12761275
String tableId = unionDTO.getCurrentDs().getId();
1277-
12781276
if (ObjectUtils.isEmpty(datasetTable)) {
12791277
DEException.throwException(Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId));
12801278
}
1279+
String table = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
1280+
12811281
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField());
12821282
if (CollectionUtils.isEmpty(fields)) {
12831283
DEException.throwException(Translator.get("i18n_cst_ds_tb_or_field_deleted") + String.format(":table id [%s]", tableId));
@@ -1473,7 +1473,11 @@ public void saveTableField(DatasetTable datasetTable) throws Exception {
14731473
datasetTableField.setTableId(datasetTable.getId());
14741474
datasetTableField.setOriginName(filed.getFieldName());
14751475
datasetTableField.setName(filed.getRemarks());
1476-
datasetTableField.setDataeaseName(DorisTableUtils.columnName(filed.getFieldName()));
1476+
if (datasetTable.getMode() == 1 && StringUtils.equalsIgnoreCase("union", datasetTable.getType())) {
1477+
datasetTableField.setDataeaseName(filed.getFieldName());
1478+
} else {
1479+
datasetTableField.setDataeaseName(DorisTableUtils.columnName(filed.getFieldName()));
1480+
}
14771481
datasetTableField.setType(filed.getFieldType());
14781482
if (ObjectUtils.isEmpty(ds)) {
14791483
datasetTableField.setDeType(transFieldType(filed.getFieldType()));

frontend/src/views/dataset/add/union/UnionEdit.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<div v-if="unionParam.type" style="height:600px;">
33
<div class="field-style">
44
<div class="fields">
5-
<p>{{ unionParam.parent.currentDs.name }}</p>
5+
<p :title="unionParam.parent.currentDs.name">{{ unionParam.parent.currentDs.name }}</p>
66
<union-field-list :field-list="parentField" :node="unionParam.parent" @checkedFields="changeParentFields" />
77
</div>
88
<div class="fields">
9-
<p>{{ unionParam.node.currentDs.name }}</p>
9+
<p :title="unionParam.parent.currentDs.name">{{ unionParam.node.currentDs.name }}</p>
1010
<union-field-list :field-list="nodeField" :node="unionParam.node" @checkedFields="changeNodeFields" />
1111
</div>
1212
</div>
@@ -81,6 +81,9 @@ export default {
8181
p{
8282
font-size: 14px;
8383
margin: 6px 0!important;
84+
text-overflow: ellipsis;
85+
overflow: hidden;
86+
white-space: nowrap;
8487
}
8588
.el-divider--horizontal {
8689
margin: 12px 0;

0 commit comments

Comments
 (0)