1. 遇到的问题
使用mybatis plus出现There is no getter for property named 'null' in 'xx'
遇到这种情况,一般是使用updateById等,根据主键进行增删改的方法。但是实体类上没有加@TableId注解导致的。
2.自定义Sql的使用场景
需要批量更新多条数据的某个字段,而不是单个字段时,可以通过自定义Sql实现批量更新单个字段。
如何判断,mybtis-plus 的updateByIds 更新的是哪些字段?
可以通过单元测试,然后再mybatis-log 插件中查看执行的Sql进行判断。