The mybatisPlus update strategy causes the update to fail

insert image description here
As shown in the figure, when selecting the associated template, cancel it, and
insert image description here
when updating, it will prompt that the operation is successful, but refresh the page again and find that the data is still there:

insert image description here
The solution first: add the comment of mp above the field:

@TableField(updateStrategy = FieldStrategy.IGNORED)

insert image description here
The reason for the failure is: when using updateById to update, if the field is empty, no update will be performed. The function of this annotation is to ignore the update strategy of mp. If it is not empty, just leave it empty: mp provides the following strategies
insert image description here
Reference link: Mybatis-Plus global Update update strategy, and insert query strategy

Guess you like

Origin blog.csdn.net/weixin_42260782/article/details/129565433