@@ -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 ()));
0 commit comments