一、问题引入
简单来说:代码自动识别的login_id与数据库loginId名不一致
这是一个映射错误问题
二、问题解决
@Data
@TableName("t_user_basic")
public class User implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String loginId;
private String nickName;
private String pwd;
private String headImg;
}
原先代码上加入 @TableField("数据库属性名")
@Data
@TableName("t_user_basic")
public class User implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("loginId")
private String loginId;
@TableField("nickName")
private String nickName;
private String pwd;
@TableField("headImg")
private String headImg;
}