public static <T> List<List<T>> batchList(List<T> list) { List<List<T>> lists = new ArrayList<>(); int pointsDataLimit = 1000;//限制条数 int size = list.size(); //判断是否有必要分批 if (pointsDataLimit < size) { int totalPage = size / pointsDataLimit;//分批数 if (size % pointsDataLimit != 0) { totalPage += 1; } for (int i = 0; i < totalPage; i++) { //1000条 List listPage; if (i == totalPage - 1) { listPage = list.subList(i * pointsDataLimit, size); } else { listPage = list.subList(i * pointsDataLimit, (i + 1) * pointsDataLimit); } lists.add(listPage); } } else { lists.add(list); } return lists; }