mybatisplus updateByid
时间: 2023-09-09 07:09:31 浏览: 116
详解MybatisPlus.zip
MyBatis-Plus中的updateById方法是根据主键ID更新记录的方法。它相当于通用Mapper中的updateByPrimaryKeySelective方法,只会更新非空字段。如果想要更新所有字段(无论字段是否为空),可以通过扩展BaseMapper来实现。可以创建一个ExBaseMapper接口继承自BaseMapper,并在其中添加一个updateByIdAll方法,该方法可以更新所有字段,包括NULL和空串。具体的实现可以参考引用和引用中的代码示例。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Mybatis-plus:update updateById](https://blog.csdn.net/yubin1285570923/article/details/117281721)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [MyBatis-Plus实现updateByIdAll()方法,更新包括NULL值字段](https://blog.csdn.net/qq_29550537/article/details/117083520)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文