Update YonghuVO.java

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

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