使用mybatisplus的insert方法报错:org.apache.ibatis.reflection.ReflectionException: Could not set property ‘id’ of ‘class com.beyond.core.web.role.entity.Role’ with value ‘1392351105974304770’ Cause: java.lang.IllegalArgumentException: argument type mismatch
错误原因:
没有设置ID字段自增的注解;
解决:
实体类ID字段加上注解:@TableId(value = “id”, type = IdType.AUTO)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
问题解决,顺利插入!
ps :也看到很多答案讲是关于参数类型不匹配造成,具体情况具体讨论,欢迎讨论和指教喔~