int batchCount = 100;// 每批commit的个数
int batchLastIndex = batchCount - 1;// 每批最后一个的下标
for (int index = 0; index < allList.size();) {
if (batchLastIndex > allList.size() - 1) {
batchLastIndex = allList.size() - 1;
resultList = allList.subList(index, batchLastIndex + 1);
departClassInfo.setList(resultList);
departClassInfoMapper.batchImport(departClassInfo);
break;// 数据插入完毕,退出循环
} else {
resultList = allList.subList(index, batchLastIndex + 1);
departClassInfo.setList(resultList);
departClassInfoMapper.batchImport(departClassInfo);
index = batchLastIndex + 1;// 设置下一批下标
batchLastIndex = index + (batchCount - 1);
}
}