mybatisplus 更新字段
时间: 2023-09-09 13:12:21 浏览: 101
Mybatis Plus在进行更新操作时,默认情况下是不能将字段更新为null的。如果要更新字段为null,需要进行以下处理。首先,需要在需要更新的字段上加上@TableField注解,并设置属性updateStrategy=FieldStrategy.IGNORED。这样,Mybatis Plus在更新操作时就会忽略该字段的值,从而可以将其更新为null。此外,也可以手动编写更新SQL语句,通过使用set语句将字段更新为null。总之,要更新字段为null,需要进行相应的注解设置或手动编写更新SQL语句。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [mybatis plus 更新字段为 null](https://blog.csdn.net/wsjzzcbq/article/details/122472810)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [Mybatis-plus更新操作更新字段空值问题](https://blog.csdn.net/paidaxinga_/article/details/123230046)[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^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文