赞
踩
- List<samples> samples = dao.getSamples();
-
- if (samples.size() > 0) {
- final int total = samples.size();// 总记录数
- final int batchSize = 10000; // 每次插入记录数
- int toIndex = batchSize; // 数据存一次的索引
- for(int fromIndex = 0; fromIndex < total; fromIndex += batchSize) {
- toIndex = Math.min(fromIndex + batchSize, total);
- // 拆分的提交数据
- List<ProSample> subList = samples.subList(fromIndex, toIndex);
- proSampleMapper.insertSampleBatch(businessId, subList);
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。