MybatisPlus-in 超过1000问题
------工具类
public static <T> List<List<T>> groupingList(List<T> list, int partSize) { List<List<T>> groups = new ArrayList(); if (list != null && !list.isEmpty()) { int dataCount = list.size(); int groupCount = dataCount / partSize; if (dataCount % partSize != 0) { ++groupCount; } for(int i = 0; i < groupCount; ++i) { int start = i * partSize; int end = (i + 1) * partSize - 1; if (end > dataCount - 1) { end = dataCount - 1; } List<T> bacths = new ArrayList(); for(int j = start; j <= end; ++j) { bacths.add(list.get(j)); } groups.add(bacths); } return groups; } else { return groups; } }
------使用方法
this.groupingList(new ArrayList<Long>(targetCallRespIds), 1000);