forked from github/dataease
commit
f7eebcebf6
@ -18,6 +18,7 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
||||
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
|
||||
import io.dataease.plugins.datasource.entity.Dateformat;
|
||||
import io.dataease.plugins.datasource.entity.PageInfo;
|
||||
import io.dataease.plugins.datasource.query.QueryProvider;
|
||||
import io.dataease.plugins.datasource.query.Utils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@ -362,7 +363,15 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
|
||||
if (isTable) {
|
||||
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
|
||||
} else {
|
||||
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
|
||||
}
|
||||
}
|
||||
|
||||
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(DorisConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -434,7 +443,12 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
.build();
|
||||
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
|
||||
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
|
||||
return sqlLimit(st.render(), view);
|
||||
return st.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,6 +18,7 @@ import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
||||
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
|
||||
import io.dataease.plugins.datasource.entity.Dateformat;
|
||||
import io.dataease.plugins.datasource.entity.PageInfo;
|
||||
import io.dataease.plugins.datasource.query.QueryProvider;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -362,7 +363,15 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
|
||||
if (isTable) {
|
||||
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
|
||||
} else {
|
||||
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
|
||||
}
|
||||
}
|
||||
|
||||
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MysqlConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -434,7 +443,12 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
.build();
|
||||
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
|
||||
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
|
||||
return sqlLimit(st.render(), view);
|
||||
return st.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,6 +18,7 @@ import io.dataease.plugins.common.dto.sqlObj.SQLObj;
|
||||
import io.dataease.plugins.common.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.plugins.common.request.permission.DataSetRowPermissionsTreeDTO;
|
||||
import io.dataease.plugins.common.request.permission.DatasetRowPermissionsTreeItem;
|
||||
import io.dataease.plugins.datasource.entity.PageInfo;
|
||||
import io.dataease.plugins.datasource.entity.Dateformat;
|
||||
import io.dataease.plugins.datasource.query.QueryProvider;
|
||||
import io.dataease.plugins.datasource.query.Utils;
|
||||
@ -375,6 +376,19 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
|
||||
@Override
|
||||
public String getSQLTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
return sqlLimit(originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view), view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
|
||||
if(isTable){
|
||||
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
|
||||
}else {
|
||||
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
|
||||
}
|
||||
}
|
||||
|
||||
private String originalTableInfo(String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) {
|
||||
SQLObj tableObj = SQLObj.builder()
|
||||
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MySQLConstants.KEYWORD_TABLE, table))
|
||||
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
|
||||
@ -445,7 +459,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
.build();
|
||||
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
|
||||
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
|
||||
return sqlLimit(st.render(), view);
|
||||
return st.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user