wjy_branch
wangjiaoyan 3 weeks ago
parent 12cf9b7cc1
commit ed884e68c8

@ -5,53 +5,68 @@ package com.yj.bean;
* @create 2020-08-21 10:41 * @create 2020-08-21 10:41
*/ */
public class User { public class User {
// 用户ID使用Integer类型以便于处理数据库中的null值
private Integer id; private Integer id;
// 用户名
private String username; private String username;
// 密码
private String password; private String password;
// 邮箱地址
private String email; private String email;
// 用户地址
private String address; private String address;
// 获取用户地址
public String getAddress() { public String getAddress() {
return address; return address;
} }
// 设置用户地址
public void setAddress(String address) { public void setAddress(String address) {
this.address = address; this.address = address;
} }
// 获取用户ID
public Integer getId() { public Integer getId() {
return id; return id;
} }
// 设置用户ID
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
// 获取用户名
public String getUsername() { public String getUsername() {
return username; return username;
} }
// 设置用户名
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
// 获取密码
public String getPassword() { public String getPassword() {
return password; return password;
} }
// 设置密码
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
// 获取邮箱
public String getEmail() { public String getEmail() {
return email; return email;
} }
// 设置邮箱
public void setEmail(String email) { public void setEmail(String email) {
this.email = email; this.email = email;
} }
// 重写toString方法方便输出用户信息
@Override @Override
public String toString() { public String toString() {
return "User{" + return "User{" +
@ -63,9 +78,11 @@ public class User {
'}'; '}';
} }
// 无参构造函数
public User() { public User() {
} }
// 带参数的构造函数,用于创建用户对象时初始化属性
public User(Integer id, String username, String password, String email, String address) { public User(Integer id, String username, String password, String email, String address) {
this.id = id; this.id = id;
this.username = username; this.username = username;
@ -74,3 +91,4 @@ public class User {
this.address = address; this.address = address;
} }
} }

Loading…
Cancel
Save