提交 3cbeaa1b authored 作者: mry's avatar mry

fix(web): 修改了也出超出范围的报错信息

上级 36101754
...@@ -9,11 +9,12 @@ import org.matrix.exception.GlobalException; ...@@ -9,11 +9,12 @@ import org.matrix.exception.GlobalException;
public class PageTools { public class PageTools {
public static void pageTool(int pageSize, int pageNum, Page<?> results) { public static void pageTool(int pageSize, int pageNum, Page<?> results) {
int type = 0;
//总共多少条数据 //总共多少条数据
long total = results.getTotal(); long total = results.getTotal();
//页数 //页数
long length = total / pageSize; long length = total / pageSize;
if (length == 0){ if (length == 0) {
length = 1; length = 1;
} }
if (total % pageSize != 0) { if (total % pageSize != 0) {
...@@ -21,7 +22,7 @@ public class PageTools { ...@@ -21,7 +22,7 @@ public class PageTools {
} }
if (pageNum > length) { if (pageNum > length) {
throw new GlobalException(String throw new GlobalException(String
.format("您查询的页码已经超出范围,允许查询的最大页码是 %d,您查询的页码是 %d",length,pageNum)); .format("%d 您查询的页码已经超出范围,允许查询的最大页码是 %d,您查询的页码是 %d",type, length, pageNum));
} }
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论