场景

使用MybatisPlus执行插入操作时提示:

 Could not set property 'id' of 'class com.badao.beans.Employee' with value

MybatisPlus提示 Could not set property 'id' of '***' with valueMybatisPlus提示 Could not set property 'id' of '***' with value

实现

找到实体类

添加主键策略以及制定表名

MP支持以下4种主键策略:

描述
IdType.AUTO 数据库ID自增
IdType.INPUT 用户输入ID
IdType.ID_WORKER 全局唯一ID,内容为空自动填充(默认配置)
IdType.UUID 全局唯一ID,内容为空自动填充

这里数据中的表设计的是自增,所以在id上指定 

@TableId(value="id",type=IdType.AUTO)

相关文章:

  • 2022-01-07
  • 2021-12-10
  • 2022-12-23
  • 2021-10-16
  • 2022-01-09
  • 2021-12-02
  • 2021-08-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-19
  • 2022-01-23
相关资源
相似解决方案