diff --git a/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java b/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java index a1160b5f42..5e992c7ee6 100644 --- a/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java +++ b/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java @@ -124,10 +124,9 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService { tableName = dataSetTableService.getCustomSQLDatasource(dataTableInfoDTO, list, ds); break; case UNION: - Datasource datasource = new Datasource(); - datasource.setType(pluginViewSet.getDsType()); + Datasource datasource = ((PluginViewSetImpl) pluginViewSet).getDs(); Map sqlMap = dataSetTableService.getUnionSQLDatasource(dataTableInfoDTO, datasource); - tableName = (String) sqlMap.get("sql"); + tableName = "(" + ((String) sqlMap.get("sql")) + ")"; break; default: tableName = dataTableInfoDTO.getTable();