废话少说直接上代码
private void updateFlow() { // 查询 jf_state,shoufeiriqi 字段 List<Map<String, Object>> list = chargeBillMapper.getCwglList(); if (list != null && list.size() > 0) { // 设置批量更新条数 int pointsDataLimit = 2000; int listSize = list.size(); int maxSize = listSize - 1; List<Map<String, Object>> newList = new ArrayList<>(); for (int i = 0; i < listSize; i++) { //分批次处理 newList.add(list.get(i)); if (pointsDataLimit == newList.size() || i == maxSize) { //载体list达到要求,进行批量操作 //批量插入 int integer = renwuFlowMapper.updCwgl(newList); if (integer > 0) { newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入 } } } } }