Update YonghuEntity.java

王刚注释
pz2femycj 4 months ago
parent af8eb02ecf
commit 1f76f6f0ce

@ -1,356 +1,273 @@
package com.entity; // 包声明
package com.entity;
import com.annotation.ColumnInfo;
import javax.validation.constraints.*; // 导入Java核心库
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.io.Serializable;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.io.Serializable; import java.util.Date;
import java.util.*;
import org.apache.tools.ant.util.DateUtils; // 导入校验相关注解
import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.beanutils.BeanUtils; // 导入Jackson注解
import com.baomidou.mybatisplus.annotations.TableField; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotations.TableId; import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType; // 导入Apache工具类
import com.baomidou.mybatisplus.enums.FieldFill; import org.apache.tools.ant.util.DateUtils;
import com.utils.DateUtil; import org.apache.commons.beanutils.BeanUtils;
// 导入Spring框架注解
/** import org.springframework.format.annotation.DateTimeFormat;
*
* // 导入MyBatis Plus注解
* @author import com.baomidou.mybatisplus.annotations.TableField;
* @email import com.baomidou.mybatisplus.annotations.TableId;
*/ import com.baomidou.mybatisplus.annotations.TableName;
@TableName("yonghu") import com.baomidou.mybatisplus.enums.IdType;
public class YonghuEntity<T> implements Serializable { import com.baomidou.mybatisplus.enums.FieldFill;
private static final long serialVersionUID = 1L;
// 导入自定义注解和工具类
import com.annotation.ColumnInfo;
public YonghuEntity() { import com.utils.DateUtil;
} // 用户实体类对应数据库表yonghu
@TableName("yonghu")
public YonghuEntity(T t) { public class YonghuEntity<T> implements Serializable {
try { // 序列化版本UID
BeanUtils.copyProperties(this, t); private static final long serialVersionUID = 1L;
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 无参构造方法
e.printStackTrace(); public YonghuEntity() {
} }
}
// 带泛型参数的构造方法通过BeanUtils进行属性拷贝
public YonghuEntity(T t) {
/** try {
* BeanUtils.copyProperties(this, t);
*/ } catch (IllegalAccessException | InvocationTargetException e) {
@TableId(type = IdType.AUTO) // 异常处理(打印堆栈跟踪)
@ColumnInfo(comment="主键",type="int(11)") e.printStackTrace();
@TableField(value = "id") }
}
private Integer id;
// 主键(自增)
@TableId(type = IdType.AUTO)
/** @ColumnInfo(comment = "主键", type = "int(11)")
* @TableField(value = "id")
*/ private Integer id;
@ColumnInfo(comment="账户",type="varchar(200)")
@TableField(value = "username") // 用户账户
@ColumnInfo(comment = "账户", type = "varchar(200)")
private String username; @TableField(value = "username")
private String username;
/** // 登录密码
* @ColumnInfo(comment = "密码", type = "varchar(200)")
*/ @TableField(value = "password")
@ColumnInfo(comment="密码",type="varchar(200)") private String password;
@TableField(value = "password")
// 用户真实姓名
private String password; @ColumnInfo(comment = "用户名称", type = "varchar(200)")
@TableField(value = "yonghu_name")
private String yonghuName;
/**
* // 用户手机号码
*/ @ColumnInfo(comment = "用户手机号", type = "varchar(200)")
@ColumnInfo(comment="用户名称",type="varchar(200)") @TableField(value = "yonghu_phone")
@TableField(value = "yonghu_name") private String yonghuPhone;
private String yonghuName; // 用户身份证号码
@ColumnInfo(comment = "用户身份证号", type = "varchar(200)")
@TableField(value = "yonghu_id_number")
/** private String yonghuIdNumber;
*
*/ // 用户头像存储路径
@ColumnInfo(comment="用户手机号",type="varchar(200)") @ColumnInfo(comment = "用户头像", type = "varchar(200)")
@TableField(value = "yonghu_phone") @TableField(value = "yonghu_photo")
private String yonghuPhoto;
private String yonghuPhone;
// 性别0=未知,1=男,2=女)
@ColumnInfo(comment = "性别", type = "int(11)")
/** @TableField(value = "sex_types")
* private Integer sexTypes;
*/
@ColumnInfo(comment="用户身份证号",type="varchar(200)") // 用户电子邮箱
@TableField(value = "yonghu_id_number") @ColumnInfo(comment = "用户邮箱", type = "varchar(200)")
@TableField(value = "yonghu_email")
private String yonghuIdNumber; private String yonghuEmail;
// 账户余额(十进制类型)
/** @ColumnInfo(comment = "现有余额", type = "decimal(10,2)")
* @TableField(value = "new_money")
*/ private Double newMoney;
@ColumnInfo(comment="用户头像",type="varchar(200)")
@TableField(value = "yonghu_photo") // 逻辑删除标记0=正常,1=删除)
@ColumnInfo(comment = "逻辑删除", type = "int(11)")
private String yonghuPhoto; @TableField(value = "data_delete")
private Integer dataDelete;
/** // 数据插入时间(自动填充)
* @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
*/ @DateTimeFormat
@ColumnInfo(comment="性别",type="int(11)") @ColumnInfo(comment = "添加时间", type = "timestamp")
@TableField(value = "sex_types") @TableField(value = "insert_time", fill = FieldFill.INSERT)
private Date insertTime;
private Integer sexTypes;
// 记录创建时间(自动填充)
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
/** @DateTimeFormat
* @ColumnInfo(comment = "创建时间", type = "timestamp")
*/ @TableField(value = "create_time", fill = FieldFill.INSERT)
@ColumnInfo(comment="用户邮箱",type="varchar(200)") private Date createTime;
@TableField(value = "yonghu_email")
// 获取主键ID
private String yonghuEmail; public Integer getId() {
return id;
}
/**
* // 设置主键ID
*/ public void setId(Integer id) {
@ColumnInfo(comment="现有余额",type="decimal(10,2)") this.id = id;
@TableField(value = "new_money") }
private Double newMoney; // 获取用户账户
public String getUsername() {
return username;
/** }
*
*/ // 设置用户账户
@ColumnInfo(comment="逻辑删除",type="int(11)") public void setUsername(String username) {
@TableField(value = "data_delete") this.username = username;
}
private Integer dataDelete;
// 获取登录密码
public String getPassword() {
/** return password;
* }
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") // 设置登录密码
@DateTimeFormat public void setPassword(String password) {
@ColumnInfo(comment="添加时间",type="timestamp") this.password = password;
@TableField(value = "insert_time",fill = FieldFill.INSERT) }
private Date insertTime; // 获取用户真实姓名
public String getYonghuName() {
return yonghuName;
/** }
*
*/ // 设置用户真实姓名
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") public void setYonghuName(String yonghuName) {
@DateTimeFormat this.yonghuName = yonghuName;
@ColumnInfo(comment="创建时间",type="timestamp") }
@TableField(value = "create_time",fill = FieldFill.INSERT)
// 获取用户手机号
private Date createTime; public String getYonghuPhone() {
return yonghuPhone;
}
/**
* // 设置用户手机号
*/ public void setYonghuPhone(String yonghuPhone) {
public Integer getId() { this.yonghuPhone = yonghuPhone;
return id; }
}
/** // 获取身份证号码
* public String getYonghuIdNumber() {
*/ return yonghuIdNumber;
}
public void setId(Integer id) {
this.id = id; // 设置身份证号码
} public void setYonghuIdNumber(String yonghuIdNumber) {
/** this.yonghuIdNumber = yonghuIdNumber;
* }
*/
public String getUsername() { // 获取头像路径
return username; public String getYonghuPhoto() {
} return yonghuPhoto;
/** }
*
*/ // 设置头像路径
public void setYonghuPhoto(String yonghuPhoto) {
public void setUsername(String username) { this.yonghuPhoto = yonghuPhoto;
this.username = username; }
}
/** // 获取性别类型
* public Integer getSexTypes() {
*/ return sexTypes;
public String getPassword() { }
return password;
} // 设置性别类型
/** public void setSexTypes(Integer sexTypes) {
* this.sexTypes = sexTypes;
*/ }
public void setPassword(String password) { // 获取用户邮箱
this.password = password; public String getYonghuEmail() {
} return yonghuEmail;
/** }
*
*/ // 设置用户邮箱
public String getYonghuName() { public void setYonghuEmail(String yonghuEmail) {
return yonghuName; this.yonghuEmail = yonghuEmail;
} }
/**
* // 获取账户余额
*/ public Double getNewMoney() {
return newMoney;
public void setYonghuName(String yonghuName) { }
this.yonghuName = yonghuName;
} // 设置账户余额
/** public void setNewMoney(Double newMoney) {
* this.newMoney = newMoney;
*/ }
public String getYonghuPhone() {
return yonghuPhone; // 获取逻辑删除状态
} public Integer getDataDelete() {
/** return dataDelete;
* }
*/
// 设置逻辑删除状态
public void setYonghuPhone(String yonghuPhone) { public void setDataDelete(Integer dataDelete) {
this.yonghuPhone = yonghuPhone; this.dataDelete = dataDelete;
} }
/**
* // 获取数据插入时间
*/ public Date getInsertTime() {
public String getYonghuIdNumber() { return insertTime;
return yonghuIdNumber; }
}
/** // 设置数据插入时间
* public void setInsertTime(Date insertTime) {
*/ this.insertTime = insertTime;
}
public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber; // 获取记录创建时间
} public Date getCreateTime() {
/** return createTime;
* }
*/
public String getYonghuPhoto() { // 设置记录创建时间
return yonghuPhoto; public void setCreateTime(Date createTime) {
} this.createTime = createTime;
/** }
*
*/ // 重写toString方法返回对象字符串表示
@Override
public void setYonghuPhoto(String yonghuPhoto) { public String toString() {
this.yonghuPhoto = yonghuPhoto; return "Yonghu{" +
} ", id=" + id +
/** ", username=" + username +
* ", password=" + password +
*/ ", yonghuName=" + yonghuName +
public Integer getSexTypes() { ", yonghuPhone=" + yonghuPhone +
return sexTypes; ", yonghuIdNumber=" + yonghuIdNumber +
} ", yonghuPhoto=" + yonghuPhoto +
/** ", sexTypes=" + sexTypes +
* ", yonghuEmail=" + yonghuEmail +
*/ ", newMoney=" + newMoney +
", dataDelete=" + dataDelete +
public void setSexTypes(Integer sexTypes) { ", insertTime=" + DateUtil.convertString(insertTime, "yyyy-MM-dd") +
this.sexTypes = sexTypes; ", createTime=" + DateUtil.convertString(createTime, "yyyy-MM-dd") +
} "}";
/** }
* }
*/
public String getYonghuEmail() {
return yonghuEmail;
}
/**
*
*/
public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail;
}
/**
*
*/
public Double getNewMoney() {
return newMoney;
}
/**
*
*/
public void setNewMoney(Double newMoney) {
this.newMoney = newMoney;
}
/**
*
*/
public Integer getDataDelete() {
return dataDelete;
}
/**
*
*/
public void setDataDelete(Integer dataDelete) {
this.dataDelete = dataDelete;
}
/**
*
*/
public Date getInsertTime() {
return insertTime;
}
/**
*
*/
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
/**
*
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "Yonghu{" +
", id=" + id +
", username=" + username +
", password=" + password +
", yonghuName=" + yonghuName +
", yonghuPhone=" + yonghuPhone +
", yonghuIdNumber=" + yonghuIdNumber +
", yonghuPhoto=" + yonghuPhoto +
", sexTypes=" + sexTypes +
", yonghuEmail=" + yonghuEmail +
", newMoney=" + newMoney +
", dataDelete=" + dataDelete +
", insertTime=" + DateUtil.convertString(insertTime,"yyyy-MM-dd") +
", createTime=" + DateUtil.convertString(createTime,"yyyy-MM-dd") +
"}";
}
}
Loading…
Cancel
Save