1、argument type mismatch报错原因
这里数据库对应的表如果设置了主键自增时,一定要在对应实体类中加上下面的注解,不然就会报错argument type mismatch,当然了,这只是其中可能的原因之一。
/**
* id
* 这里添加详细的注解是为了插入数据记录时保证主键正常自增
*/
@TableId(value = "id",type = IdType.AUTO)
private Integer id;
2、统一的一步到位的解决办法
在properties配置文件中添加一行MybatisPlus的配置
#数据库表主键id配置为自增策略
mybatis-plus.global-config.db-config.id-type=auto
3、完整配置
#dao层配置文件配置
mybatis-plus.mapper-locations=classpath:mapper/*.xml
#dao层sql语句返回类型别名配置
mybatis-plus.type-aliases-package=com.efong.pojo
#数据库表主键id配置为自增策略
mybatis-plus.global-config.db-config.id-type=auto