zoukankan      html  css  js  c++  java
  • 分页

    List<WmsOutboundPushInfo> models = this.findByStatus(whCode, statusList,pushNum,2);
           
            if (models.isEmpty()) {
               
                return;
            }
            int pageSize = 500;// 条数
            int listCount = models.size();
            int totalPage = listCount % pageSize > 0 ? listCount / pageSize + 1 : listCount / pageSize;
            for (int i = 0; i < totalPage; i++) {
                List<WmsOutboundPushInfo> modelList = pageBySubList(models, pageSize, i + 1);
                this.updateOutboundPushInfo(modelList);
            }
     /**
         * 利用subList方法进行分页
         *
         * @param list        分页数据
         * @param pageSize    页面大小
         * @param currentPage 当前页面
         */
        public List<WmsOutboundPushInfo> pageBySubList(List<WmsOutboundPushInfo> list, int pageSize, int currentPage) {
    
            int totalCount = list.size();
            int pageCount = 0;
            List<WmsOutboundPushInfo> subList;
            int m = totalCount % pageSize;
            if (m > 0) {
                pageCount = totalCount / pageSize + 1;
            } else {
                pageCount = totalCount / pageSize;
            }
            if (m == 0) {
                subList = list.subList((currentPage - 1) * pageSize, pageSize * (currentPage));
            } else {
                if (currentPage == pageCount) {
                    subList = list.subList((currentPage - 1) * pageSize, totalCount);
                } else {
                    subList = list.subList((currentPage - 1) * pageSize, pageSize * (currentPage));
                }
            }
            return subList;
        }
  • 相关阅读:
    [ABC142F] Pure
    [ABC141F] Xor Sum 3
    tarjan缩点
    LoadRunner录制:事务
    LoadRunner录制:脚本调试
    linux性能监控命令
    Python 3 解析 html
    Python 3 操作json 文件
    Python 数据驱动工具:DDT
    selenium 问题:OSError: [WinError 6] 句柄无效
  • 原文地址:https://www.cnblogs.com/lanliying/p/15386411.html
Copyright © 2011-2022 走看看