前提
mybatis plus 自带的updateBatchById方法很6,可以支持使用key批量更新数据。不过因需求要求,现遇需根据多栏位筛选批量更新,很是伤感(吃现成的最开心了)。
源码:
public boolean updateBatchById(Collection<T> entityList, int batchSize) {
Assert.notEmpty(entityList, "error: entityList must not be empty");
String sqlStatement = sqlStatement(SqlMethod.UPDATE_BY_ID);
try (SqlSession batchSqlSession = sqlSessionBatch()) {
int i = 0;
for (T anEntityList : entityList) {
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>(