PageUtil
package cn.com.qmhd.oto.common; import java.io.Serializable;
import java.util.List; import org.springframework.data.domain.PageImpl; /**
* 转换为json时需要的bean
* @version 1.0
* @时间 2016年9月14日
* @描述
*/
public class Page<T> implements Serializable { private static final long serialVersionUID = -3640039664184539350L;
//当前页
private long page;
//前一页
private long prePage;
//后一页
private long nextPage;
//每页大小
private long pageSize;
//总条数
private long totalCount;
//总页数
private long pageCount;
//当前页数据
private List<T> rows;
/**
* @return the page
*/
public long getPage() {
return page;
}
/**
* @param page the page to set
*/
public void setPage(long page) {
this.page = page;
}
/**
* @return the prePage
*/
public long getPrePage() {
return prePage;
}
/**
* @param prePage the prePage to set
*/
public void setPrePage(long prePage) {
this.prePage = prePage;
}
/**
* @return the nextPage
*/
public long getNextPage() {
if(nextPage<=0){
return 1;
}else{
return nextPage>pageCount?pageCount:nextPage;
}
}
/**
* @param nextPage the nextPage to set
*/
public void setNextPage(long nextPage) {
this.nextPage = nextPage;
}
/**
* @return the pageSize
*/
public long getPageSize() {
return pageSize;
}
/**
* @param pageSize the pageSize to set
*/
public void setPageSize(long pageSize) {
this.pageSize = pageSize<=0?10:pageSize;
}
/**
* @return the totalCount
*/
public long getTotalCount() {
return totalCount;
}
/**
* @param totalCount the totalCount to set
*/
public void setTotalCount(long totalCount) {
this.totalCount = totalCount;
}
/**
* @return the pageCount
*/
public long getPageCount() {
return pageCount;
}
/**
* @param pageCount the pageCount to set
*/
public void setPageCount(long pageCount) {
this.pageCount = pageCount;
}
/**
* @return the rows
*/
public List<T> getRows() {
return rows;
}
/**
* @param rows the rows to set
*/
public void setRows(List<T> rows) {
this.rows = rows;
}
public void resetNextPage(){
nextPage=page+1;
this.prePage = page -1>0?page-1:1;
pageCount=totalCount%pageSize==0?totalCount/pageSize:totalCount/pageSize+1;
} public Page(org.springframework.data.domain.Page<T> pageImpl) {
if(pageImpl!=null){
this.page = pageImpl.getNumber()+1;
this.pageSize = pageImpl.getSize();
this.rows = pageImpl.getContent();
this.totalCount = pageImpl.getTotalElements();
this.pageCount = pageImpl.getTotalPages();
resetNextPage();
}
}
public Page() {
}
}
PageUtil的更多相关文章
- jsp+oracle 排序分页+Pageutil类
1.rownum和排序 Oracle中的rownum的是在取数据的时候产生的序号,所以想对指定排序的数据去指定的rowmun行数据就必须注意了. SQL> select rownum ,id,n ...
- jsp分页代码之pageUtil类
pageUtil类负责得到每页的开始数和结束数 package control; public class PageUtil { private int pageSize;//每页显示的条数 priv ...
- PageUtil.java分页工具类
package com.chabansheng.util; /** * 分页工具类 * @author Administrator * */ public class PageUtil { /** * ...
- 一个简单的对任意list分页的工具-----PageUtil
一.工具类代码 1 import java.util.List; 2 import java.util.stream.Collectors; 3 4 public class PageUtil< ...
- PageUtil 分页
/** * 分页工具类 * @author Administrator * */ public class PageUtil { /** * 生成分页代码 * @param targetUrl 目标地 ...
- PageUtil ,简单的分页工具
public class PageUtil { private int totalCount;//总数 private int pageSize=10;//每页显示数量 private int cur ...
- pageUtil分页工具
分页工具: https://www.cnblogs.com/ggq-insist-qiang/articles/10095603.html
- 流程开发Activiti 与SpringMVC整合实例
流程(Activiti) 流程是完成一系列有序动作的概述.每一个节点动作的结果将对后面的具体操作步骤产生影响.信息化系统中流程的功能完全等同于纸上办公的层级审批,尤其在oa系统中各类电子流提现较为明显 ...
- SSH:Struts2.2+Hibernate3.6+Spring3.1分页示例[转]
参考资料 1 ssh分页(多个例子) http://useryouyou.iteye.com/blog/593954 2 ssh2分页例子 http://459104018-qq-com.iteye. ...
随机推荐
- CGI与ISAPI的区别(转)
一 CGI原理及其性能 1) CGI概念CGI即通用网关接口(Common Gateway Interface),它是一段程序,运行在服务器上,提供同客户端HTML页面的交互,通俗的讲CGI就象是一座 ...
- 如何使用图形界面Webmin管理linux服务器
出处:http://linux.cn/thread/11992/1/1/ 如何使用图形界面Webmin管理linux服务器 一台典型的linux服务器运行命令行环境中,并已经包括了一些用于安装和配置各 ...
- React-setState源码的理解
首先举一个最简单的例子: this.state={ a:1 } this.setState({ a:2 }) console.log(this.state.a)//1 可以说setState()操作是 ...
- B-Tree概念
记录下学习B-Tree: concept:(m-阶) 1. 根节点 孩子数 ( 2 <= N <= m) 根节点key数([m/2] - 1 <= n <= m -1) 2 ...
- 递归树处理,配合vue的vueTreeselect组件使用
在项目中经常会使用到tree,并且需要对递归树进行操作. 在vue项目中,使用vue-treeselect插件(https://vue-treeselect.js.org/) 使用中遇到的问题: 1. ...
- tcpdump的使用以及参数详解
平时分析客户端和服务器网络交互的问题时,很多情况下需要在客户端和服务器抓包分析报文.一般win下抓包使用WireShark即可,但是linux下就需要用到tcpdump了,下面是一些对于tcpdump ...
- 5kcrm增加权限管理中的模块(签到统计)
1 首先在model表增加模块名称 2 在controll里增加方法 3 在授权的html增加表单
- CODEVS——T 1005 生日礼物
http://codevs.cn/problem/1005/ 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description ...
- xftp和xshell的使用
Xftp和Xshell配合使用部署环境. (linux系统) Xftp为可视化工具.主要用来复制文件. xshell则通过输入命令来对server进行操作,如启动服务等等. 一. Xftp的连接 新 ...
- hdu 5077 NAND(打表)2014 Asia regional 鞍山站 H题
题目链接:点击打开链接 题意:就是一个按位运算的一个函数.问最少经过多少步运算能够得到给定数. 思路:不是我投机取巧想打表.是特么这题仅仅能打表.. .打表思想用能够得到的数的集合表示状态bfs:最后 ...