package cn.com.basic.face.service.sqlite; import cn.com.basic.face.discern.common.CommonVariables; /** * Created by dpy on 2017/7/20. */ public class BaseDao { /** * 获取分页开始行 * @param pageNum * @return */ public int getStartIndex(Integer pageNum){ if(pageNum == null || pageNum <= 0){ return 0; } return (pageNum-1)*Integer.parseInt(CommonVariables.Page.DEFAULT_PAGE_SIZE); } /** * 获取总页数 * @param total * @return */ public int getTotalPageSize(Integer total){ if(total == null || total <= 0){ return 1; } int pageSize = Integer.parseInt(CommonVariables.Page.DEFAULT_PAGE_SIZE); return total%pageSize == 0 ? total/pageSize : total/pageSize + 1; } }