MVC的分页实体类与分页计算工具类
来源:互联网 发布:网络调查的分类 编辑:程序博客网 时间:2024/06/13 21:58
分页实体类:
package cn.et.emp.utils;import java.util.List;public class PageEntity {/** * 数据库查询的总条数 */private int totalSize;/** * 每页显示的条数 */private int pageSize=10;/** * 总页数 * * totalSize=20 pageSize=10 * 最后公式:pageCount=(totalSize%pageSize==0?totalSize/pageSize:(totalSize/pageSize+1)) */private int pageCount;/** * 当前页 */private int curPage;/** * 上一页 * prevPage=curPage==1?curPage:curPage-1 */private int prevPage;/** * 下一页 * 最后公式:nextPage=curPage<pageCount?curPage+1:curPage; */private int nextPage;/** * * startIndex=(curPage-1)*pageSize+1 * endIndex=curPage*pageSize */private int startIndex;private int endIndex;private List data;private String queryName;public String getQueryName() {return queryName;}public void setQueryName(String queryName) {this.queryName = queryName;}public int getTotalSize() {return totalSize;}public void setTotalSize(int totalSize) {this.totalSize = totalSize;}public int getPageSize() {return pageSize;}public void setPageSize(int pageSize) {this.pageSize = pageSize;}public int getPageCount() {return pageCount;}public void setPageCount(int pageCount) {this.pageCount = pageCount;}public int getCurPage() {return curPage;}public void setCurPage(int curPage) {this.curPage = curPage;}public int getPrevPage() {return prevPage;}public void setPrevPage(int prevPage) {this.prevPage = prevPage;}public int getNextPage() {return nextPage;}public void setNextPage(int nextPage) {this.nextPage = nextPage;}public int getStartIndex() {return startIndex;}public void setStartIndex(int startIndex) {this.startIndex = startIndex;}public int getEndIndex() {return endIndex;}public void setEndIndex(int endIndex) {this.endIndex = endIndex;}public List getData() {return data;}public void setData(List data) {this.data = data;}}
分页计算工具类:
package cn.et.emp.utils;public class PageUtils {/** * 计算上一页、下一页等... * @param curPage当前页 * @param pageSize每页显示的条数 * @param totalSize数据库查询的总条数 * @return */ public static PageEntity calc(int curPage, int pageSize, int totalSize){ PageEntity pe = new PageEntity(); pe.setCurPage(curPage); pe.setPageSize(pageSize); pe.setTotalSize(totalSize); int pageCount=(totalSize%pageSize==0?totalSize/pageSize:(totalSize/pageSize+1)); int prevPage=curPage==1?curPage:curPage-1; int nextPage=curPage<pageCount?curPage+1:curPage; int startIndex=(curPage-1)*pageSize+1; int endIndex=curPage*pageSize; pe.setPageCount(pageCount); pe.setPrevPage(prevPage); pe.setNextPage(nextPage); pe.setStartIndex(startIndex); pe.setEndIndex(endIndex); return pe; }}
阅读全文
0 0
- MVC的分页实体类与分页计算工具类
- 分页实体类代码
- 分页用实体类
- 分页的工具类
- 分页实体类和响应实体类
- 通用的分页工具类
- 分页的封装工具类
- 分页工具类
- 分页工具类
- 分页工具类
- 分页工具类
- java分页工具类
- 分页通用工具类
- hibernate分页工具类
- 分页工具类
- 分页工具类
- 分页工具类
- Web分页工具类
- Pandas Index 更新和计算(Modifying&computations)
- openwrt编译用于mt7688的mplayer
- 库克逼腾讯分成30%遭拒,苹果APP Store或将微信下架!
- 利用Docker搭建大数据处理集群
- 在hadoop2.8的HA+zookeeper的环境下安装分布式HBase 1.2.5 以及HMaster的高可用(HA)
- MVC的分页实体类与分页计算工具类
- Markdown简明语法
- (乱入)excel按照某一列数据(相同的)join 两表的其他数据
- redis 和java项目整合
- 有序广播
- ListView中图片的优化
- 学习Win32框架的一点总结
- 关于多线程传递参数调用方法
- 人工智能如此火爆,程序员要失业了是真的吗?