//将入库数据分批导入 List<List<Scene>> partitionList = Lists.partition(list, 500); //批量导入 for (List<Scene> scenes : partitionList) { //onlineFormJdbcDao.get() 获取jdbcTemplate onlineFormJdbcDao.get().batchUpdate(sql, new BatchPreparedStatementSetter() { public void setValues(PreparedStatement ps, int i) throws SQLException { ps.setString(1, scenes.get(i).getSceneName()); ps.setString(2, scenes.get(i).getProvince()); ps.setString(3, scenes.get(i).getCityName()); ps.setString(4, scenes.get(i).getDistrictName()); ps.setString(5, scenes.get(i).getSceneType()); ps.setString(6, scenes.get(i).getSceneLevel()); ps.setString(7, scenes.get(i).getFirstLevelScene()); ps.setString(8, scenes.get(i).getSecondLevelScene()); ps.setString(9, scenes.get(i).getSceneBorder()); ps.setStr
JdbcTemplate 批量导入
于 2022-02-11 20:36:08 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)