Mybatis是如何把数据库数据封装到对象中的?
Mybatis是如何把数据库数据封装到对象中的?
2.表对应的实体类
@Data
@ApiModel("用户账号")
public class User {
@ApiModelProperty(value = "用户id")
Integer id;
@ApiModelProperty(value = "密码")
String password;
@ApiModelProperty(value = "用户名")
String name;
@ApiModelProperty(value = "状态")
Integer type;
public void setType(Integer type) {
if (type == null) {
this.type = 0;
} else {
this.type = type;
}
System.out.println("id为"+this.id+"的type = " + this.type);
}
public void setName(String name) {
this.name = name;
System.out.println("id为"+this.id+"的name = " + this.name);
}
}