package net.vv2.Utils; import com.xiaoleilu.hutool.util.PageUtil; /** * 简单分页工具 * 返回总页数,并根据当前页值取得mysql limit 偏移量值 * @author J.Sky bosichong@qq.com * @create 2017-06-13 11:16 **/ public class PageHelp { /** * 总记录数 */ private int count; /** * 每页行数 */ private int rows =10; /** * 当前页数值 默认为1 */ private int pageNum = 1; public PageHelp() { } /** * * @param count 记录总数 * @param pageNum 当前页码数 * @param rows 每页显示的行数 */ public PageHelp(int count, int pageNum,int rows) { this.count = count; this.rows = rows; this.pageNum = pageNum; } public void setCount(int count) { this.count = count; } public void setRows(int rows) { this.rows = rows; } public void setPageNum(int pageNum) { this.pageNum = pageNum; } public int getCount() { return count; } public int getRows() { return rows; } public int getPageNum() { return pageNum; } /** * 获得翻页数据数组包括: * 分页数 * mysql limit偏移量 * @return int[] */ public int[] getPageArray(){ if(count == 0){ return null; } int totalPage = PageUtil.totalPage(count,rows);//根据记录总数获得分页总数 int offset = (pageNum-1)*rows;//获得当前偏移量。 return new int[]{totalPage,offset}; } }

kk992127170 LV6
2022年12月27日
tgeuuy LV10
2022年10月25日
testuser1234567 LV24
2022年6月8日
zhos0212 LV19
2022年4月20日
zackery LV9
2022年4月19日
fantesy LV17
2022年3月3日
wang512237140 LV20
2021年12月21日
tansuo阿郎 LV8
2021年11月17日
尹恒yingying LV18
2021年10月22日
huaua7676 LV30
2021年9月25日

梁小贤 LV1
5月22日
微信网友_7442146341474304
3月27日
暂无贡献等级
ma406805131 LV19
2024年12月19日
citybird LV4
2024年11月18日
栾庆浩
2024年10月29日
暂无贡献等级
小小ffggyh LV1
2024年9月12日
嘻嘻不嘻嘻
2024年8月5日
暂无贡献等级
dapeng0011 LV15
2024年6月22日
f22m1a2b2 LV17
2024年6月8日
一只大笨熊啊
2024年6月8日
暂无贡献等级