/**
* 分页显示页数控制工具类
* @author Administrator
*
*/
public class PageUtil {
/**
* 计算总页数
*
* @param totalSize
* 信息总条数
* @param pageSize
* 每页条数
* @return
*/
public static final Integer calTotalPageSize(Integer totalSize,
Integer pageSize) {
Integer totalpageSize = 1;
if (totalSize % pageSize == 0) {
totalpageSize = totalSize / pageSize;
} else {
totalpageSize = totalSize / pageSize + 1;
}
return totalpageSize;
}
/**
* 检查当前页数(不能小于1,不能大于最大页数)
*
* @param pageIndex
* @param totalpageSize
* @return
*/
public static final Integer checkPageIndex(Integer pageIndex,
Integer totalpageSize) {
if (pageIndex < 1) {
pageIndex = 1;
} else if (pageIndex > totalpageSize) {
pageIndex = totalpageSize;
}
return pageIndex;
}
}
信息分页显示页数控制工具类
猜你喜欢
转载自blog.csdn.net/qq_38039015/article/details/82050488
今日推荐
周排行