articles) { String sql = "UPDATE article SET title = ?, description = ? WHERE id = ?"; // spring jdbc 幫我們生成了批量插入的 sql 語句, 我們也可以直接使用批量的插入 sql 語句進行批量數據插入 return jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement preparedStatement, int i) throws SQLException { Article article = articles.get(i); preparedStatement.setString(1, article.getTitle()); preparedStatement.setString(2, article.getDescription()); preparedStatement.setInt(3, article.getId()); } @Override public int getBatchSize() { return articles.size(); } }).length;}/** * 批量刪除數據 */public int batchDeleteArticle(final List