forked from github/dataease
fix: 插件视图使用带scheme的数据源没有设置scheme导致查询不到数据
This commit is contained in:
parent
a6495e3086
commit
4ee6d86251
@ -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;
|
||||||
|
}
|
@ -5,6 +5,7 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import io.dataease.auth.entity.SysUserEntity;
|
import io.dataease.auth.entity.SysUserEntity;
|
||||||
import io.dataease.auth.service.AuthUserService;
|
import io.dataease.auth.service.AuthUserService;
|
||||||
|
import io.dataease.commons.model.PluginViewSetImpl;
|
||||||
import io.dataease.ext.*;
|
import io.dataease.ext.*;
|
||||||
import io.dataease.commons.constants.CommonConstants;
|
import io.dataease.commons.constants.CommonConstants;
|
||||||
import io.dataease.commons.constants.JdbcConstants;
|
import io.dataease.commons.constants.JdbcConstants;
|
||||||
@ -1094,9 +1095,10 @@ public class ChartViewService {
|
|||||||
|
|
||||||
private PluginViewParam buildPluginParam(Map<String, List<ChartViewFieldDTO>> fieldMap, List<ChartFieldCustomFilterDTO> customFilters, List<ChartExtFilterRequest> extFilters, Datasource ds, DatasetTable table, ChartViewDTO view) {
|
private PluginViewParam buildPluginParam(Map<String, List<ChartViewFieldDTO>> fieldMap, List<ChartFieldCustomFilterDTO> customFilters, List<ChartExtFilterRequest> extFilters, Datasource ds, DatasetTable table, ChartViewDTO view) {
|
||||||
PluginViewParam pluginViewParam = new PluginViewParam();
|
PluginViewParam pluginViewParam = new PluginViewParam();
|
||||||
PluginViewSet pluginViewSet = BeanUtils.copyBean(new PluginViewSet(), table);
|
PluginViewSetImpl pluginViewSet = BeanUtils.copyBean(new PluginViewSetImpl(), table);
|
||||||
pluginViewSet.setDsType(ds.getType());
|
pluginViewSet.setDsType(ds.getType());
|
||||||
pluginViewSet.setTabelId(table.getId());
|
pluginViewSet.setTabelId(table.getId());
|
||||||
|
pluginViewSet.setDs(ds);
|
||||||
PluginViewLimit pluginViewLimit = BeanUtils.copyBean(new PluginViewLimit(), view);
|
PluginViewLimit pluginViewLimit = BeanUtils.copyBean(new PluginViewLimit(), view);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package io.dataease.service.chart;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import io.dataease.commons.model.PluginViewSetImpl;
|
||||||
import io.dataease.dto.dataset.DataSetTableUnionDTO;
|
import io.dataease.dto.dataset.DataSetTableUnionDTO;
|
||||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
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 tabelName = (tableName.startsWith("(") && tableName.endsWith(")")) ? tableName : String.format(keyword, tableName);
|
||||||
String tabelAlias = String.format(TABLE_ALIAS_PREFIX, 0);
|
String tabelAlias = String.format(TABLE_ALIAS_PREFIX, 0);
|
||||||
PluginViewSQL tableObj = PluginViewSQL.builder().tableName(tabelName).tableAlias(tabelAlias).build();
|
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;
|
return tableObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user