集合批量处理数据

List<DAiCollection> list = aiCollectionDao.getNeedPushAiCollection();

// 每次处理条数 100
int batchCount = 100;
for (int i = 0; i < list.size(); i += batchCount) {
  int end = i + batchCount;
  end = end > list.size() ? list.size() : end;

  // 该批次处理的数据
  List<DAiCollection> sendList = list.subList(i, end);

}

posted @ 2022-04-22 13:54  亲爱的阿道君  阅读(59)  评论(0)    收藏  举报