|
|
|
@ -1,134 +1,212 @@
|
|
|
|
|
package com.entity.vo;
|
|
|
|
|
|
|
|
|
|
import com.entity.JianshenkechengLiuyanEntity;
|
|
|
|
|
// 包声明:实体类包,存放所有与数据库表映射的JavaBean对象
|
|
|
|
|
package com.entity;
|
|
|
|
|
|
|
|
|
|
// 字段描述注解:自定义数据库字段元数据
|
|
|
|
|
import com.annotation.ColumnInfo;
|
|
|
|
|
// 数据校验注解:提供非空、长度等验证规则
|
|
|
|
|
import javax.validation.constraints.*;
|
|
|
|
|
// JSON序列化配置:忽略未定义属性
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
|
|
// 反射异常类:处理属性拷贝时的异常
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
// 序列化接口标识
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
// 集合工具类
|
|
|
|
|
import java.util.*;
|
|
|
|
|
// Apache Ant日期工具(代码中未使用,建议移除)
|
|
|
|
|
import org.apache.tools.ant.util.DateUtils;
|
|
|
|
|
// Spring日期参数绑定注解
|
|
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
|
|
// Jackson日期格式化注解
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
|
|
// Bean属性拷贝工具
|
|
|
|
|
import org.apache.commons.beanutils.BeanUtils;
|
|
|
|
|
// MyBatis Plus字段注解
|
|
|
|
|
import com.baomidou.mybatisplus.annotations.TableField;
|
|
|
|
|
// MyBatis Plus主键注解
|
|
|
|
|
import com.baomidou.mybatisplus.annotations.TableId;
|
|
|
|
|
// MyBatis Plus表名注解
|
|
|
|
|
import com.baomidou.mybatisplus.annotations.TableName;
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
|
|
// MyBatis Plus主键策略枚举
|
|
|
|
|
import com.baomidou.mybatisplus.enums.IdType;
|
|
|
|
|
// MyBatis Plus字段填充策略
|
|
|
|
|
import com.baomidou.mybatisplus.enums.FieldFill;
|
|
|
|
|
// 自定义日期格式化工具
|
|
|
|
|
import com.utils.DateUtil;
|
|
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
|
|
|
|
|
// 健身课程留言手机端接口返回VO,去除不必要字段
|
|
|
|
|
@TableName("jianshenkecheng_liuyan")
|
|
|
|
|
public class JianshenkechengLiuyanVO implements Serializable {
|
|
|
|
|
// 课程留言实体
|
|
|
|
|
// 映射数据库表 jianshenkecheng_liuyan
|
|
|
|
|
// 存储用户对健身课程的留言及管理员回复信息
|
|
|
|
|
|
|
|
|
|
@TableName("jianshenkecheng_liuyan") // 指定关联数据库表名
|
|
|
|
|
public class JianshenkechengLiuyanEntity<T> implements Serializable {
|
|
|
|
|
// 序列化版本标识(类版本控制)
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
// 主键ID
|
|
|
|
|
@TableField(value = "id")
|
|
|
|
|
private Integer id;
|
|
|
|
|
// 空构造器(持久层框架需要)
|
|
|
|
|
public JianshenkechengLiuyanEntity() {
|
|
|
|
|
|
|
|
|
|
// 关联的健身课程ID
|
|
|
|
|
@TableField(value = "jianshenkecheng_id")
|
|
|
|
|
private Integer jianshenkechengId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 留言用户ID
|
|
|
|
|
@TableField(value = "yonghu_id")
|
|
|
|
|
private Integer yonghuId;
|
|
|
|
|
// 泛型构造器:通过反射进行属性拷贝
|
|
|
|
|
public JianshenkechengLiuyanEntity(T t) {
|
|
|
|
|
try {
|
|
|
|
|
BeanUtils.copyProperties(this, t); // 使用Apache工具类拷贝属性
|
|
|
|
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
|
|
|
|
e.printStackTrace(); // 生产环境建议改为日志记录
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 留言内容文本
|
|
|
|
|
@TableField(value = "jianshenkecheng_liuyan_text")
|
|
|
|
|
private String jianshenkechengLiuyanText;
|
|
|
|
|
// 主键字段(自增策略)
|
|
|
|
|
@TableId(type = IdType.AUTO) // 主键生成策略:数据库自增
|
|
|
|
|
@ColumnInfo(comment="主键",type="int(11)") // 字段注释:主键,数据库类型int(11)
|
|
|
|
|
@TableField("id") // 映射数据库字段名
|
|
|
|
|
private Integer id; // 唯一标识符
|
|
|
|
|
|
|
|
|
|
// 留言时间(带时区格式化)
|
|
|
|
|
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
@DateTimeFormat
|
|
|
|
|
@TableField(value = "insert_time")
|
|
|
|
|
private Date insertTime;
|
|
|
|
|
// 关联健身课程ID(外键)
|
|
|
|
|
@ColumnInfo(comment="健身课程",type="int(11)") // 关联jianshenkecheng表主键
|
|
|
|
|
@TableField("jianshenkecheng_id")
|
|
|
|
|
private Integer jianshenkechengId; // 被评论的课程ID
|
|
|
|
|
|
|
|
|
|
// 关联用户ID(外键)
|
|
|
|
|
@ColumnInfo(comment="用户",type="int(11)") // 关联yonghu表主键
|
|
|
|
|
@TableField("yonghu_id")
|
|
|
|
|
private Integer yonghuId; // 留言用户ID
|
|
|
|
|
|
|
|
|
|
// 留言内容(需考虑敏感词过滤)
|
|
|
|
|
@ColumnInfo(comment="留言内容",type="longtext") // 数据库类型longtext
|
|
|
|
|
@TableField("jianshenkecheng_liuyan_text")
|
|
|
|
|
private String jianshenkechengLiuyanText; // 用户留言正文
|
|
|
|
|
|
|
|
|
|
// 管理员回复内容
|
|
|
|
|
@TableField(value = "reply_text")
|
|
|
|
|
private String replyText;
|
|
|
|
|
// 留言时间(自动填充)
|
|
|
|
|
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") // 响应JSON格式
|
|
|
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 请求参数格式
|
|
|
|
|
@ColumnInfo(comment="留言时间",type="timestamp") // 数据库类型timestamp
|
|
|
|
|
@TableField(value = "insert_time", fill = FieldFill.INSERT) // 插入时自动填充
|
|
|
|
|
private Date insertTime; // 用户提交留言时间
|
|
|
|
|
|
|
|
|
|
// 回复时间(带时区格式化)
|
|
|
|
|
// 管理员回复内容(null表示未回复)
|
|
|
|
|
@ColumnInfo(comment="回复内容",type="longtext")
|
|
|
|
|
@TableField("reply_text")
|
|
|
|
|
private String replyText; // 管理员回复正文
|
|
|
|
|
|
|
|
|
|
// 回复时间(更新时自动填充)
|
|
|
|
|
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
@DateTimeFormat
|
|
|
|
|
@TableField(value = "update_time")
|
|
|
|
|
private Date updateTime;
|
|
|
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
@ColumnInfo(comment="回复时间",type="timestamp")
|
|
|
|
|
@TableField(value = "update_time", fill = FieldFill.UPDATE) // 更新时自动填充
|
|
|
|
|
private Date updateTime; // 最后回复/更新时间
|
|
|
|
|
|
|
|
|
|
// 记录创建时间(用于特定展示场景)
|
|
|
|
|
// 创建时间(与insert_time可能存在冗余)
|
|
|
|
|
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
@DateTimeFormat
|
|
|
|
|
@TableField(value = "create_time")
|
|
|
|
|
private Date createTime;
|
|
|
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
@ColumnInfo(comment="创建时间",type="timestamp")
|
|
|
|
|
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
|
|
|
|
private Date createTime; // 记录创建时间(建议确认业务需求)
|
|
|
|
|
|
|
|
|
|
// ----------------------------- Getter/Setter方法 -----------------------------
|
|
|
|
|
|
|
|
|
|
// 获取:主键ID
|
|
|
|
|
// 主键访问器
|
|
|
|
|
public Integer getId() {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置:主键ID
|
|
|
|
|
// 主键修改器
|
|
|
|
|
public void setId(Integer id) {
|
|
|
|
|
this.id = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取:关联课程ID
|
|
|
|
|
// 课程ID访问器
|
|
|
|
|
public Integer getJianshenkechengId() {
|
|
|
|
|
return jianshenkechengId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置:关联课程ID
|
|
|
|
|
// 课程ID修改器(应校验课程存在性)
|
|
|
|
|
public void setJianshenkechengId(Integer jianshenkechengId) {
|
|
|
|
|
this.jianshenkechengId = jianshenkechengId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取:留言用户ID
|
|
|
|
|
// 用户ID访问器
|
|
|
|
|
public Integer getYonghuId() {
|
|
|
|
|
return yonghuId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置:留言用户ID
|
|
|
|
|
// 用户ID修改器(应校验用户存在性)
|
|
|
|
|
public void setYonghuId(Integer yonghuId) {
|
|
|
|
|
this.yonghuId = yonghuId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取:留言内容
|
|
|
|
|
// 留言内容访问器
|
|
|
|
|
public String getJianshenkechengLiuyanText() {
|
|
|
|
|
return jianshenkechengLiuyanText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置:留言内容
|
|
|
|
|
// 留言内容修改器(建议添加敏感词过滤)
|
|
|
|
|
public void setJianshenkechengLiuyanText(String jianshenkechengLiuyanText) {
|
|
|
|
|
this.jianshenkechengLiuyanText = jianshenkechengLiuyanText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取:留言时间
|
|
|
|
|
// 留言时间访问器(通常自动生成)
|
|
|
|
|
public Date getInsertTime() {
|
|
|
|
|
return insertTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置:留言时间
|
|
|
|
|
// 留言时间修改器(通常无需手动设置)
|
|
|
|
|
public void setInsertTime(Date insertTime) {
|
|
|
|
|
this.insertTime = insertTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取:回复内容
|
|
|
|
|
// 回复内容访问器
|
|
|
|
|
public String getReplyText() {
|
|
|
|
|
return replyText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置:回复内容
|
|
|
|
|
// 回复内容修改器(需权限控制)
|
|
|
|
|
public void setReplyText(String replyText) {
|
|
|
|
|
this.replyText = replyText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取:回复时间
|
|
|
|
|
// 回复时间访问器
|
|
|
|
|
public Date getUpdateTime() {
|
|
|
|
|
return updateTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置:回复时间
|
|
|
|
|
// 回复时间修改器(通常自动更新)
|
|
|
|
|
public void setUpdateTime(Date updateTime) {
|
|
|
|
|
this.updateTime = updateTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取:创建时间(展示用)
|
|
|
|
|
// 创建时间访问器(注意与insert_time区别)
|
|
|
|
|
public Date getCreateTime() {
|
|
|
|
|
return createTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置:创建时间(展示用)
|
|
|
|
|
// 创建时间修改器(需确认业务场景)
|
|
|
|
|
public void setCreateTime(Date createTime) {
|
|
|
|
|
this.createTime = createTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 对象字符串表示(调试用)
|
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
|
|
|
|
return "JianshenkechengLiuyan{" +
|
|
|
|
|
// 主键ID
|
|
|
|
|
", id=" + id +
|
|
|
|
|
// 关联课程ID
|
|
|
|
|
", jianshenkechengId=" + jianshenkechengId +
|
|
|
|
|
// 用户ID
|
|
|
|
|
", yonghuId=" + yonghuId +
|
|
|
|
|
// 留言内容(建议截断显示)
|
|
|
|
|
", jianshenkechengLiuyanText=" + jianshenkechengLiuyanText +
|
|
|
|
|
// 留言时间(格式化为日期)
|
|
|
|
|
", insertTime=" + DateUtil.convertString(insertTime,"yyyy-MM-dd") +
|
|
|
|
|
// 回复内容(建议截断显示)
|
|
|
|
|
", replyText=" + replyText +
|
|
|
|
|
// 最后更新时间(格式化为日期)
|
|
|
|
|
", updateTime=" + DateUtil.convertString(updateTime,"yyyy-MM-dd") +
|
|
|
|
|
// 记录创建时间
|
|
|
|
|
", createTime=" + DateUtil.convertString(createTime,"yyyy-MM-dd") +
|
|
|
|
|
"}";
|
|
|
|
|
}
|
|
|
|
|
}
|