概述
在开发中使用Mybatis时,可能会在mysql中直接设置主键自增,改用mybatis plus的save方法时,它的主键是自动注入的,如果你在mysql中同样设置id自增,就很有可能会导致mybatis plus自动注入的主键值太大无法写入到 数据库中,如果你使用@TableField(exist = false)则会报如下错误
Could not set property ‘id’ of ‘xxx’ with value ‘’ Cause argument type mismatch
解决
解决办法是,把它设置为自增就可以了,这样mybatis plus就不会自动注入Id了,而是让mysql自己注入