// 包声明 package com.entity; // 导入Java核心库 import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.util.Date; // 导入校验相关注解 import javax.validation.constraints.*; // 导入Jackson注解 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonFormat; // 导入Apache工具类 import org.apache.tools.ant.util.DateUtils; import org.apache.commons.beanutils.BeanUtils; // 导入Spring框架注解 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") public class YonghuEntity implements Serializable { // 序列化版本UID 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") private Integer id; // 用户账户 @ColumnInfo(comment = "账户", type = "varchar(200)") @TableField(value = "username") private String username; // 登录密码 @ColumnInfo(comment = "密码", type = "varchar(200)") @TableField(value = "password") private String password; // 用户真实姓名 @ColumnInfo(comment = "用户名称", type = "varchar(200)") @TableField(value = "yonghu_name") private String yonghuName; // 用户手机号码 @ColumnInfo(comment = "用户手机号", type = "varchar(200)") @TableField(value = "yonghu_phone") private String yonghuPhone; // 用户身份证号码 @ColumnInfo(comment = "用户身份证号", type = "varchar(200)") @TableField(value = "yonghu_id_number") private String yonghuIdNumber; // 用户头像存储路径 @ColumnInfo(comment = "用户头像", type = "varchar(200)") @TableField(value = "yonghu_photo") private String yonghuPhoto; // 性别(0=未知,1=男,2=女) @ColumnInfo(comment = "性别", type = "int(11)") @TableField(value = "sex_types") private Integer sexTypes; // 用户电子邮箱 @ColumnInfo(comment = "用户邮箱", type = "varchar(200)") @TableField(value = "yonghu_email") private String yonghuEmail; // 账户余额(十进制类型) @ColumnInfo(comment = "现有余额", type = "decimal(10,2)") @TableField(value = "new_money") private Double newMoney; // 逻辑删除标记(0=正常,1=删除) @ColumnInfo(comment = "逻辑删除", type = "int(11)") @TableField(value = "data_delete") private Integer dataDelete; // 数据插入时间(自动填充) @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat @ColumnInfo(comment = "添加时间", type = "timestamp") @TableField(value = "insert_time", fill = FieldFill.INSERT) private Date insertTime; // 记录创建时间(自动填充) @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) private Date createTime; // 获取主键ID public Integer getId() { return id; } // 设置主键ID public void setId(Integer id) { this.id = id; } // 获取用户账户 public String getUsername() { return username; } // 设置用户账户 public void setUsername(String username) { this.username = username; } // 获取登录密码 public String getPassword() { return password; } // 设置登录密码 public void setPassword(String password) { this.password = password; } // 获取用户真实姓名 public String getYonghuName() { return yonghuName; } // 设置用户真实姓名 public void setYonghuName(String yonghuName) { this.yonghuName = yonghuName; } // 获取用户手机号 public String getYonghuPhone() { return yonghuPhone; } // 设置用户手机号 public void setYonghuPhone(String yonghuPhone) { this.yonghuPhone = yonghuPhone; } // 获取身份证号码 public String getYonghuIdNumber() { return yonghuIdNumber; } // 设置身份证号码 public void setYonghuIdNumber(String yonghuIdNumber) { this.yonghuIdNumber = yonghuIdNumber; } // 获取头像路径 public String getYonghuPhoto() { return yonghuPhoto; } // 设置头像路径 public void setYonghuPhoto(String yonghuPhoto) { this.yonghuPhoto = yonghuPhoto; } // 获取性别类型 public Integer getSexTypes() { return sexTypes; } // 设置性别类型 public void setSexTypes(Integer sexTypes) { this.sexTypes = sexTypes; } // 获取用户邮箱 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; } // 重写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") + "}"; } }