From 61334f483a471441f53f7dc930f65ccd19ff3eb4 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Fri, 7 Mar 2025 19:27:51 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1371810887598080]报表分页优化 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1371810887598080 --- .../module/report/widget/DrawTable.java | 66 +++++++++++++++++-- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/src/main/java/neatlogic/module/report/widget/DrawTable.java b/src/main/java/neatlogic/module/report/widget/DrawTable.java index 239422f..02846a5 100644 --- a/src/main/java/neatlogic/module/report/widget/DrawTable.java +++ b/src/main/java/neatlogic/module/report/widget/DrawTable.java @@ -153,12 +153,70 @@ public class DrawTable implements TemplateMethodModelEx { sb.append(" 条"); int prevPage = currentPage - 1; sb.append("
  • "); + // 首页码 + List homePageList = new ArrayList<>(1); + // 向前 5 页页码 + List forward5PageList = new ArrayList<>(1); + // 上2页 页码 + List previous2PageList = new ArrayList<>(2); + // 当前页码 + List currentPageList = new ArrayList<>(1); + // 后2页 页码 + List next2PageList = new ArrayList<>(2); + // 向后 5 页页码 + List backward5PageList = new ArrayList<>(1); + // 尾页码 + List lastPageList = new ArrayList<>(1); for (int i = 1; i <= pageCount; i++) { - sb.append("
  • " + i + "
  • "); + } + if (CollectionUtils.isNotEmpty(homePageList)) { + int i = homePageList.get(0); + sb.append("
  • " + i + "
  • "); + } + if (CollectionUtils.isNotEmpty(forward5PageList)) { + int i = Math.max(forward5PageList.get(0), 1); + sb.append("
  • "); + } + if (CollectionUtils.isNotEmpty(previous2PageList)) { + for (Integer i : previous2PageList) { + sb.append("
  • " + i + "
  • "); + } + } + if (CollectionUtils.isNotEmpty(currentPageList)) { + int i = currentPageList.get(0); + sb.append("
  • " + i + "
  • "); + } + if (CollectionUtils.isNotEmpty(next2PageList)) { + for (Integer i : next2PageList) { + sb.append("
  • " + i + "
  • "); + } + } + if (CollectionUtils.isNotEmpty(backward5PageList)) { + int i = Math.min(backward5PageList.get(0), pageCount); + sb.append("
  • "); + } + if (CollectionUtils.isNotEmpty(lastPageList)) { + int i = lastPageList.get(0); + sb.append("
  • " + i + "
  • "); } int nextPage = currentPage + 1; sb.append("
  • "); -- Gitee