forked from github/dataease
fix: 抽取模式插件视图不可用
This commit is contained in:
parent
28d567447e
commit
8137acfd50
@ -784,6 +784,7 @@ public class ChartViewService {
|
|||||||
PluginViewParam pluginViewParam = new PluginViewParam();
|
PluginViewParam pluginViewParam = new PluginViewParam();
|
||||||
PluginViewSet pluginViewSet = BeanUtils.copyBean(new PluginViewSet(), table);
|
PluginViewSet pluginViewSet = BeanUtils.copyBean(new PluginViewSet(), table);
|
||||||
pluginViewSet.setDsType(ds.getType());
|
pluginViewSet.setDsType(ds.getType());
|
||||||
|
pluginViewSet.setTabelId(table.getId());
|
||||||
PluginViewLimit pluginViewLimit = BeanUtils.copyBean(new PluginViewLimit(), view);
|
PluginViewLimit pluginViewLimit = BeanUtils.copyBean(new PluginViewLimit(), view);
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,29 +93,35 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService {
|
|||||||
public PluginViewSQL getTableObj(PluginViewSet pluginViewSet) {
|
public PluginViewSQL getTableObj(PluginViewSet pluginViewSet) {
|
||||||
String tableName = null;
|
String tableName = null;
|
||||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(pluginViewSet.getInfo(), DataTableInfoDTO.class);
|
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(pluginViewSet.getInfo(), DataTableInfoDTO.class);
|
||||||
switch (pluginViewSet.getType()) {
|
if (ObjectUtils.isNotEmpty(pluginViewSet.getMode()) && 1 == pluginViewSet.getMode()) {
|
||||||
case "db":
|
|
||||||
tableName = dataTableInfoDTO.getTable();
|
|
||||||
break;
|
|
||||||
case "sql":
|
|
||||||
tableName = dataTableInfoDTO.getSql();
|
|
||||||
break;
|
|
||||||
case "custom":
|
|
||||||
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId());
|
|
||||||
Datasource ds = new Datasource();
|
|
||||||
ds.setType(pluginViewSet.getDsType());
|
|
||||||
tableName = dataSetTableService.getCustomSQLDatasource(dataTableInfoDTO, list, ds);
|
|
||||||
break;
|
|
||||||
case "union":
|
|
||||||
Datasource datasource = new Datasource();
|
|
||||||
datasource.setType(pluginViewSet.getDsType());
|
|
||||||
Map<String, Object> sqlMap = dataSetTableService.getUnionSQLDatasource(dataTableInfoDTO, datasource);
|
|
||||||
tableName = (String) sqlMap.get("sql");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
tableName = "ds_" + pluginViewSet.getTabelId().replaceAll("-", "_");
|
||||||
|
|
||||||
|
}else {
|
||||||
|
switch (pluginViewSet.getType()) {
|
||||||
|
case "db":
|
||||||
|
tableName = dataTableInfoDTO.getTable();
|
||||||
|
break;
|
||||||
|
case "sql":
|
||||||
|
tableName = dataTableInfoDTO.getSql();
|
||||||
|
break;
|
||||||
|
case "custom":
|
||||||
|
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId());
|
||||||
|
Datasource ds = new Datasource();
|
||||||
|
ds.setType(pluginViewSet.getDsType());
|
||||||
|
tableName = dataSetTableService.getCustomSQLDatasource(dataTableInfoDTO, list, ds);
|
||||||
|
break;
|
||||||
|
case "union":
|
||||||
|
Datasource datasource = new Datasource();
|
||||||
|
datasource.setType(pluginViewSet.getDsType());
|
||||||
|
Map<String, Object> sqlMap = dataSetTableService.getUnionSQLDatasource(dataTableInfoDTO, datasource);
|
||||||
|
tableName = (String) sqlMap.get("sql");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tableName = dataTableInfoDTO.getTable();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
String keyword = ConstantsUtil.constantsValue(pluginViewSet.getDsType(), "KEYWORD_TABLE");
|
String keyword = ConstantsUtil.constantsValue(pluginViewSet.getDsType(), "KEYWORD_TABLE");
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user