diff --git a/backend/src/main/java/io/dataease/commons/model/PluginViewSetImpl.java b/backend/src/main/java/io/dataease/commons/model/PluginViewSetImpl.java new file mode 100644 index 0000000000..125c772261 --- /dev/null +++ b/backend/src/main/java/io/dataease/commons/model/PluginViewSetImpl.java @@ -0,0 +1,11 @@ +package io.dataease.commons.model; + +import io.dataease.plugins.common.base.domain.Datasource; +import io.dataease.plugins.view.entity.PluginViewSet; +import lombok.Data; + +@Data +public class PluginViewSetImpl extends PluginViewSet { + + private Datasource ds; +} diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index d5d2bb2e6b..16f2bcfb12 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -5,6 +5,7 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import io.dataease.auth.entity.SysUserEntity; import io.dataease.auth.service.AuthUserService; +import io.dataease.commons.model.PluginViewSetImpl; import io.dataease.ext.*; import io.dataease.commons.constants.CommonConstants; import io.dataease.commons.constants.JdbcConstants; @@ -1094,9 +1095,10 @@ public class ChartViewService { private PluginViewParam buildPluginParam(Map> fieldMap, List customFilters, List extFilters, Datasource ds, DatasetTable table, ChartViewDTO view) { PluginViewParam pluginViewParam = new PluginViewParam(); - PluginViewSet pluginViewSet = BeanUtils.copyBean(new PluginViewSet(), table); + PluginViewSetImpl pluginViewSet = BeanUtils.copyBean(new PluginViewSetImpl(), table); pluginViewSet.setDsType(ds.getType()); pluginViewSet.setTabelId(table.getId()); + pluginViewSet.setDs(ds); PluginViewLimit pluginViewLimit = BeanUtils.copyBean(new PluginViewLimit(), view); 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 eac7c169c0..7b331b7ca6 100644 --- a/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java +++ b/backend/src/main/java/io/dataease/service/chart/ViewPluginBaseServiceImpl.java @@ -2,6 +2,7 @@ package io.dataease.service.chart; import cn.hutool.core.util.ReflectUtil; import com.google.gson.Gson; +import io.dataease.commons.model.PluginViewSetImpl; import io.dataease.dto.dataset.DataSetTableUnionDTO; import io.dataease.dto.dataset.DataTableInfoDTO; import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs; @@ -128,6 +129,19 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService { String tabelName = (tableName.startsWith("(") && tableName.endsWith(")")) ? tableName : String.format(keyword, tableName); String tabelAlias = String.format(TABLE_ALIAS_PREFIX, 0); PluginViewSQL tableObj = PluginViewSQL.builder().tableName(tabelName).tableAlias(tabelAlias).build(); + + + QueryProvider queryProvider = ProviderFactory.getQueryProvider(pluginViewSet.getDsType()); + + SQLObj sqlObj = SQLObj.builder().tableName(tabelName).tableAlias(tabelAlias).build(); + PluginViewSetImpl child = (PluginViewSetImpl)pluginViewSet; + queryProvider.setSchema(sqlObj, child.getDs()); + // String methodName = "setSchema"; + // execProviderMethod(queryProvider, methodName, sqlObj, child.getDs()); + tableObj.setTableName(sqlObj.getTableName()); + tableObj.setTableAlias(sqlObj.getTableAlias()); + + return tableObj; }