zouxuan 5 月之前
父節點
當前提交
ce1dc49b2b
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java

+ 6 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java

@@ -138,7 +138,9 @@ public class PageInfo<T> implements Serializable {
 	}
 
 	public int getTotalPage() {
-		this.totalPage = new BigDecimal(total).divide(new BigDecimal(limit), 0, BigDecimal.ROUND_CEILING).intValue();
+		if(limit>0){
+			this.totalPage=new BigDecimal(total).divide(new BigDecimal(limit),0,BigDecimal.ROUND_CEILING).intValue();
+		}
 		return totalPage;
 	}
 
@@ -148,6 +150,9 @@ public class PageInfo<T> implements Serializable {
 
 	public void setTotal(int total) {
 		this.total = total;
+		if(limit>0){
+			this.totalPage=new BigDecimal(total).divide(new BigDecimal(limit),0,BigDecimal.ROUND_CEILING).intValue();
+		}
 	}
 
 	public List<T> getRows() {