/**
* 批量删除
* @param statementName sql文件ID
* @param list 参数集合
*/
public void batchDelete(final String statementName, final List list) throws Exception{
if (list != null) {
this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
executor.startBatch();
for (int i = 0, n = list.size(); i < n; i++) {
executor.delete(statementName, list.get(i));
}
executor.executeBatch();
return null;
}
});
}
}
/**
* 批量修改
* @param statementName sql文件ID
* @param list 参数集合
*/
public void batchUpdate(final String statementName, final List list) throws Exception{
if (list != null) {
this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
executor.startBatch();
for (int i = 0, n = list.size(); i < n; i++) {
executor.update(statementName, list.get(i));
}
executor.executeBatch();
return null;
}
});
}
}
/**
* 批量添加
* @param statementName sql文件ID
* @param list 参数集合
*/
public void batchInsert(final String statementName, final List list) throws Exception{
if (list != null) {
this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
executor.startBatch();
for (int i = 0, n = list.size(); i < n; i++) {
executor.insert(statementName, list.get(i));
}
executor.executeBatch();
return null;
}
});
}
}