mapper.xml
insert into t_gceb_login_log(
id ,
user_id ,
user_name ,
mip ,
jsession_id_4a ,
create_by ,
create_by_name ,
update_by ,
update_by_name ,
create_time ,
update_time ,
data_version ,
attribute1 ,
attribute2 ,
attribute3 ,
attribute4 ,
attribute5 ,
attribute6
)
values
(
#{item.id},
#{item.userId},
#{item.userName},
#{item.mip},
#{item.jsessionId4a},
#{item.createBy},
#{item.createByName},
#{item.updateBy},
#{item.updateByName},
#{item.createTime},
#{item.updateTime},
#{item.dataVersion},
#{item.attribute1},
#{item.attribute2},
#{item.attribute3},
#{item.attribute4},
#{item.attribute5},
#{item.attribute6}
)
update t_gceb_login_log
when id=#{item.id} then #{item.userId}
when id=#{item.id} then #{item.attribute1}
id=#{item.id}
delete from t_gceb_login_log
id in
#{item}
注意点:批量操作也是有性能问题的,一个批次建议200条
List> batchList = ListUtils.partition(loginLogList, 200);
for (List array: batchList) {
int sum = this.sqlSessionTemplate.update("loginLog.updateBatch", array);
LOGGER.debug("批量更新记录数:{}", sum);
}