Exemple #1
0
  /**
   * 批量操作
   *
   * @param sql
   * @param obj
   * @return
   */
  public int[] batchOperate(String sql, List<?> obj) {

    int[] a = null;
    try {
      a = simpleJdbcTemplate.batchUpdate(sql, SqlParameterSourceUtils.createBatch(obj.toArray()));
    } catch (Exception e) {
      log.info(e);
      return null;
      // throw new DaoException("数据库操作失败!",e);
    }
    return a;
  }
Exemple #2
0
 private int[] batchUpdateByParams(String sqlStr, List<Object[]> arrayList) {
   int[] updateCounts = simpleJdbcTemplate.batchUpdate(sqlStr, arrayList);
   if (null != this.additiveSql) simpleJdbcTemplate.update(this.additiveSql);
   return updateCounts;
 }
Exemple #3
0
 private int[] batchUpdateByPojo(String sqlStr, List<Object> pojoList) {
   SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(pojoList.toArray());
   int[] updateCounts = simpleJdbcTemplate.batchUpdate(sqlStr, batch);
   if (null != this.additiveSql) simpleJdbcTemplate.update(this.additiveSql);
   return updateCounts;
 }