package com.uplooking.club.util;

/**
 * Created by Administrator on 2017/2/21.
 */
public class PageUtil {

        private Integer curpage;//当前第几页

        private Integer pagenum=10;//每页多少条,limit 第二个参数

        private Integer startnum; //limit 第一个参数

        private Integer countpage;//一共 多少页

        private Integer countnum;//一共 多少条 count

        public void setStartnum(Integer startnum) {
            this.startnum = startnum;
        }
        //limit的第一个参数用公式
        public Integer getStartnum() {
            if(curpage==1){
                return 0;
            }else{
               return (curpage-1)*pagenum;
            }
        }



    public Integer getCurpage() {
            return curpage;
        }

        public void setCurpage(Integer curpage) {
            this.curpage = curpage;
        }

        public Integer getPagenum() {
            return pagenum;
        }

        public void setPagenum(Integer pagenum) {
            this.pagenum = pagenum;
        }

        public Integer getCountpage() {
            if(countnum%pagenum==0){
                countpage= countnum/pagenum;
            }else{
                countpage= countnum/pagenum+1;
            }
            return countpage;
        }

        public void setCountpage(Integer countpage) {
            this.countpage = countpage;
        }

        public Integer getCountnum() {
            return countnum;
        }

        public void setCountnum(Integer countnum) {
            this.countnum = countnum;
        }
}
