|
|
package cn.itbaizhan.po;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.Set;
|
|
|
import javax.persistence.CascadeType;
|
|
|
import javax.persistence.Entity;
|
|
|
import javax.persistence.GeneratedValue;
|
|
|
import javax.persistence.GenerationType;
|
|
|
import javax.persistence.Id;
|
|
|
import javax.persistence.ManyToOne;
|
|
|
import javax.persistence.Table;
|
|
|
@Entity //表示它是实体类,交给Hibernate管理
|
|
|
@Table(name="users") //表名
|
|
|
public class User implements java.io.Serializable {
|
|
|
@Id //加主键,一般写在其get方法上,或是属性上
|
|
|
@GeneratedValue(strategy = GenerationType.AUTO) //Id的生成策略javax.persistence包
|
|
|
private Integer userId; //用户编号
|
|
|
private String username; //用户名
|
|
|
private String password; //密码
|
|
|
private String name; //姓名
|
|
|
private String sex; //性别
|
|
|
private String address; //住址
|
|
|
private String phone; //联系电话
|
|
|
private String post; //邮寄地址
|
|
|
private String email; //Email地址
|
|
|
private Double money; //用户账户金额
|
|
|
public User() {
|
|
|
}
|
|
|
public User(String username, String password, String name, String sex,
|
|
|
String address, String phone, String post, String email,
|
|
|
Double money)
|
|
|
// User 类的构造函数,用于初始化用户对象的各种属性。{
|
|
|
// 初始化用户对象的各个属性
|
|
|
// 初始化用户对象的各个属性
|
|
|
// 设置用户名
|
|
|
this.username = username;
|
|
|
// 设置用户密码
|
|
|
this.password = password;
|
|
|
// 设置用户名字
|
|
|
this.name = name;
|
|
|
// 设置用户性别
|
|
|
this.sex = sex;
|
|
|
// 设置用户地址
|
|
|
this.address = address;
|
|
|
// 设置用户电话号码
|
|
|
this.phone = phone;
|
|
|
// 设置用户职位或角色
|
|
|
this.post = post;
|
|
|
// 设置用户电子邮件地址
|
|
|
this.email = email;
|
|
|
// 设置用户的金额
|
|
|
this.money=money;
|
|
|
}
|
|
|
// 获取用户ID的方法
|
|
|
public Integer getUserId() {
|
|
|
// 返回当前用户的用户ID
|
|
|
return this.userId;
|
|
|
}
|
|
|
// 设置用户ID的方法
|
|
|
public void setUserId(Integer userId) {
|
|
|
this.userId = userId;
|
|
|
}
|
|
|
// 获取用户名的方法
|
|
|
public String getUsername() {
|
|
|
// 获取用户名
|
|
|
return this.username;
|
|
|
}
|
|
|
// 设置用户名的方法
|
|
|
public void setUsername(String username) {
|
|
|
this.username = username;
|
|
|
}
|
|
|
// 获取密码的方法
|
|
|
public String getPassword() {
|
|
|
return this.password;
|
|
|
}
|
|
|
public void setPassword(String password) {
|
|
|
// 设置用户的密码
|
|
|
this.password = password;
|
|
|
}
|
|
|
public String getName() {
|
|
|
// 获取用户的名称
|
|
|
// 返回用户的名字
|
|
|
return this.name;
|
|
|
}
|
|
|
public void setName(String name) {
|
|
|
// 设置用户的名称
|
|
|
this.name = name;
|
|
|
}
|
|
|
// 获取用户性别的方法
|
|
|
public String getSex() {
|
|
|
// 返回用户的性别信息
|
|
|
return this.sex;
|
|
|
}
|
|
|
// 设置用户性别的方法
|
|
|
public void setSex(String sex) {
|
|
|
this.sex = sex;
|
|
|
}
|
|
|
// 获取用户地址的方法
|
|
|
public String getAddress() {
|
|
|
return this.address;
|
|
|
}
|
|
|
public void setAddress(String address) {
|
|
|
// 设置用户的地址
|
|
|
this.address = address;
|
|
|
}
|
|
|
public String getPhone() {
|
|
|
// 获取用户的电话号码
|
|
|
// 返回用户电话号码
|
|
|
return this.phone;
|
|
|
}
|
|
|
public void setPhone(String phone) {
|
|
|
// 设置用户的电话号码
|
|
|
this.phone = phone;
|
|
|
}
|
|
|
public class User {
|
|
|
// 获取用户职位的方法
|
|
|
public String getPost() {
|
|
|
return this.post;
|
|
|
}
|
|
|
// 设置用户职位的方法
|
|
|
public void setPost(String post) {
|
|
|
this.post = post;
|
|
|
}
|
|
|
// 获取用户邮箱的方法
|
|
|
// 获取用户的电子邮件地址
|
|
|
public String getEmail() {
|
|
|
return this.email;
|
|
|
}
|
|
|
public void setEmail(String email) {
|
|
|
// 设置用户的电子邮件地址
|
|
|
this.email = email;
|
|
|
}
|
|
|
public void setMoney(Double money) {
|
|
|
// 设置用户的金额
|
|
|
this.money = money;
|
|
|
}
|
|
|
public Double getMoney() {
|
|
|
// 获取用户的金额
|
|
|
return money;
|
|
|
}
|
|
|
} |