forked from github/dataease
Merge pull request #4148 from dataease/pr@dev@fix_table
fix(视图): 修复明细表结果展示条数与分页模式冲突的问题
This commit is contained in:
commit
e4555c8312
@ -279,6 +279,12 @@ public class ChartViewService {
|
|||||||
if (result == null) {
|
if (result == null) {
|
||||||
DataEaseException.throwException(Translator.get("i18n_chart_delete"));
|
DataEaseException.throwException(Translator.get("i18n_chart_delete"));
|
||||||
}
|
}
|
||||||
|
DatasetTable datasetTable = dataSetTableService.get(result.getTableId());
|
||||||
|
if (ObjectUtils.isNotEmpty(datasetTable)) {
|
||||||
|
result.setDatasetMode(datasetTable.getMode());
|
||||||
|
Datasource datasource = datasourceService.get(datasetTable.getDataSourceId());
|
||||||
|
result.setDatasourceType(datasource != null ? datasource.getType() : null);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -645,13 +651,23 @@ public class ChartViewService {
|
|||||||
// 直连明细表分页
|
// 直连明细表分页
|
||||||
Map<String, Object> mapAttr = gson.fromJson(view.getCustomAttr(), Map.class);
|
Map<String, Object> mapAttr = gson.fromJson(view.getCustomAttr(), Map.class);
|
||||||
Map<String, Object> mapSize = (Map<String, Object>) mapAttr.get("size");
|
Map<String, Object> mapSize = (Map<String, Object>) mapAttr.get("size");
|
||||||
if (StringUtils.equalsIgnoreCase(view.getType(), "table-info") && table.getMode() == 0 && StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page")) {
|
if (StringUtils.equalsIgnoreCase(view.getType(), "table-info") && table.getMode() == 0) {
|
||||||
if (chartExtRequest.getGoPage() == null) {
|
if (StringUtils.equalsIgnoreCase((String) mapSize.get("tablePageMode"), "page")) {
|
||||||
chartExtRequest.setGoPage(1L);
|
if (chartExtRequest.getGoPage() == null) {
|
||||||
}
|
chartExtRequest.setGoPage(1L);
|
||||||
if (chartExtRequest.getPageSize() == null) {
|
}
|
||||||
String pageSize = (String) mapSize.get("tablePageSize");
|
if (chartExtRequest.getPageSize() == null) {
|
||||||
chartExtRequest.setPageSize(Long.parseLong(pageSize));
|
String pageSize = (String) mapSize.get("tablePageSize");
|
||||||
|
chartExtRequest.setPageSize(Math.min(Long.parseLong(pageSize), view.getResultCount().longValue()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (StringUtils.equalsIgnoreCase(view.getResultMode(), "custom")) {
|
||||||
|
chartExtRequest.setGoPage(1L);
|
||||||
|
chartExtRequest.setPageSize(view.getResultCount().longValue());
|
||||||
|
} else {
|
||||||
|
chartExtRequest.setGoPage(null);
|
||||||
|
chartExtRequest.setPageSize(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chartExtRequest.setGoPage(null);
|
chartExtRequest.setGoPage(null);
|
||||||
@ -910,7 +926,11 @@ public class ChartViewService {
|
|||||||
String totalPageSql = null;
|
String totalPageSql = null;
|
||||||
PageInfo pageInfo = new PageInfo();
|
PageInfo pageInfo = new PageInfo();
|
||||||
pageInfo.setGoPage(chartExtRequest.getGoPage());
|
pageInfo.setGoPage(chartExtRequest.getGoPage());
|
||||||
pageInfo.setPageSize(chartExtRequest.getPageSize());
|
if (StringUtils.equalsIgnoreCase(view.getResultMode(), "custom")) {
|
||||||
|
pageInfo.setPageSize(Math.min(view.getResultCount() - (chartExtRequest.getGoPage() - 1) * chartExtRequest.getPageSize(), chartExtRequest.getPageSize()));
|
||||||
|
} else {
|
||||||
|
pageInfo.setPageSize(chartExtRequest.getPageSize());
|
||||||
|
}
|
||||||
|
|
||||||
List<ChartViewFieldDTO> detailFieldList = new ArrayList<>();
|
List<ChartViewFieldDTO> detailFieldList = new ArrayList<>();
|
||||||
String detailFieldSql = null;
|
String detailFieldSql = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user