There is no getter for property named ‘null‘ in ‘class

简介: There is no getter for property named ‘null‘ in ‘class

使用mybatis plus 时,报错,嗨,被自己蠢哭

居然是因为在设计表的时候没有设置主键,导致修改时无法找到ID,本来想不去添加主键,但是暂时还没发现mybatis plus增么 可以不设置主键的情况下修改,想想还是不行,主要我不想去多写代码(肯定不是因为懒),主要是为了,解放生产力,对就是为了解放生产力。害作为练习时长36个月的我来说,就这样吧

没有id 添加id

这下就体现出使用mybatis plus 的好处了,直接实体类添加个字段,数据库添加个字段搞定

@Data
@TableName("**")
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "***管理")
public class User extends Model<User> {
    private static final long serialVersionUID=1L;
  @TableId(type = IdType.AUTO)
  private Long id;
    /**
     * productId
     */
    @NotNull(message = "产品ID不能为空")
  @ApiModelProperty(value = "产品ID")
    private String productId;

CREATE TABLE `user` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
  `product_id` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品ID',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci

使用mybaits plus 的好处还有很多,等我们慢慢探索


目录
相关文章
|
10月前
|
容器
Echarts报错 Cant read property getWidth of null的解决方案
Echarts报错 Cant read property getWidth of null的解决方案
88 0
|
8月前
【已解决】TypeError: Cannot destructure property `createHash` of ‘undefined‘ or ‘null‘
【已解决】TypeError: Cannot destructure property `createHash` of ‘undefined‘ or ‘null‘
185 1
|
7月前
|
JavaScript API
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
98 0
|
4月前
|
Java
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
32 1
|
5月前
|
JavaScript API
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
|
12月前
|
Java
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
|
关系型数据库 MySQL
Mysql外键设置中的CASCADE、NO ACTION、RESTRICT、SET NULL
Mysql外键设置中的CASCADE、NO ACTION、RESTRICT、SET NULL
135 0
Mysql外键设置中的CASCADE、NO ACTION、RESTRICT、SET NULL
|
关系型数据库 MySQL
Mysql外键设置中的CASCADE、NO ACTION、RESTRICT、SET NULL、Set DEFAULT
Mysql外键设置中的CASCADE、NO ACTION、RESTRICT、SET NULL、Set DEFAULT
211 0
|
JavaScript
Uncaught TypeError: Cannot read property 'getItem' of null
Uncaught TypeError: Cannot read property 'getItem' of null
265 0
|
3月前
|
机器学习/深度学习 SQL 关系型数据库
【MySQL进阶之路丨第十一篇】一文带你精通MySQL NULL值处理、正则表达式
【MySQL进阶之路丨第十一篇】一文带你精通MySQL NULL值处理、正则表达式
36 0