其他分享
首页 > 其他分享> > 分批更新list

分批更新list

作者:互联网

     int pageSize = 5000;
        int totalSize = rewardAmounts.size();
        int totalPage = totalSize / pageSize;
        if (pageSize > totalSize) {
            rewardAmountService.updateBatch(rewardAmounts);
        } else {
            for (int i = 0; i < totalPage; i++) {
                rewardAmountService.updateBatch(rewardAmounts.subList(i * pageSize, (i + 1) * pageSize));
            }
            if (totalSize % pageSize != 0) {
                rewardAmountService.updateBatch(rewardAmounts.subList(totalSize - totalSize % pageSize, totalSize));
            }
        }

 

标签:rewardAmountService,pageSize,totalSize,分批,list,rewardAmounts,更新,int,updateBatch
来源: https://www.cnblogs.com/kingxiaozi/p/11635378.html