zouxuan 5 months ago
parent
commit
ce1dc49b2b

+ 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() {