public void create(List<WfCountHoursFansNum> list) {
String sql = new WfCountHoursFansNum().getCreateObjSql() ;//暂时未优化
// logger.debug("create(String sql, T t)====" + sql);
BeanPropertySqlParameterSource[] arr = null;
Object[] arrObj = null;
if (list != null) {
arrObj = list.toArray();
}
if (arrObj != null && arrObj.length > 0) {
arr = new BeanPropertySqlParameterSource[arrObj.length];
for (int i = 0; i < arrObj.length; i++) {
// if (i % 100 == 0){
// log.info((i + 1) + "/" + arrObj.length);
// }
arr[i] = new BeanPropertySqlParameterSource(arrObj[i]);
}
getSimpleJdbcTemplate().batchUpdate(sql, arr);
// log.info("finish,共计:" + objList.size());
}
}
spring批量新增mysql数据
最新推荐文章于 2024-08-14 12:05:47 发布