本文为持续更新,工作中用到,不熟悉的就记录下来以防忘记
通用mapper官方文档:https://mapperhelper.github.io/docs/2.use/
- 操作目的:批量更新某个字段
//根据id数据批量更新某字段的值,而且更新的值是一样的
Example example = new Example(CustomerAssistant.class);
example.createCriteria().andIn("id", ids);
CustomerAssistant customerAssistant = new CustomerAssistant();
customerAssistant.setPublish(1);
customerAssistant.setUpdateTime(new Date());
assistantMapper.updateByExampleSelective(customerAssistant, example);