This primary key of “id“ is primitive !不建议如此请使用包装类 in Class

1、原来内容:

@Data
@TableName("db_leads")
public class Leads {

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

    @TableField("leads_name")
    private int leadsName;

    @TableField("name")
    private String name;

    @TableField("address")
    private String address;
}

2、更改内容(int —> Integer):

private int id;
private Integer id;

3、最后结果:

@Data
@TableName("db_leads")
public class Leads {

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

    @TableField("leads_name")
    private int leadsName;

    @TableField("name")
    private String name;

    @TableField("address")
    private String address;
}
posted @ 2022-08-03 23:57  ah_lydms  阅读(1234)  评论(0编辑  收藏  举报