|
|
package com.entity;
|
|
|
|
|
|
import com.baomidou.mybatisplus.annotations.TableId;
|
|
|
import com.baomidou.mybatisplus.annotations.TableName;
|
|
|
import javax.validation.constraints.NotBlank;
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
import org.apache.commons.beanutils.BeanUtils;
|
|
|
import com.baomidou.mybatisplus.annotations.TableField;
|
|
|
import com.baomidou.mybatisplus.enums.FieldFill;
|
|
|
import com.baomidou.mybatisplus.enums.IdType;
|
|
|
|
|
|
/**
|
|
|
* 论坛
|
|
|
* 该类定义了论坛相关的数据实体,
|
|
|
*
|
|
|
*
|
|
|
* 对应数据库中的"forum"表,用于存储和传递论坛帖子等相关信息,
|
|
|
* 包含了帖子的各种属性以及对应的Getter、
|
|
|
*
|
|
|
* Setter方法,同时实现了Serializable接口以支持对象的序列化操作。
|
|
|
* @author wangmuzi
|
|
|
* @email
|
|
|
*/
|
|
|
@TableName("forum")
|
|
|
public class ForumEntity<T> implements Serializable {
|
|
|
// 用于定义序列化版本号,
|
|
|
// 保证在对象序列化和反序列化过程中的兼容性,
|
|
|
// 当类的结构发生变化时可更新该版本号
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
// 无参构造函数,用
|
|
|
// 于创建ForumEntity对象的默认实例,
|
|
|
// 在一些框架或反射创建对象的场景中可能会用到
|
|
|
public ForumEntity() {
|
|
|
|
|
|
}
|
|
|
|
|
|
// 有参构造函数,接受一个泛型参数t
|
|
|
//// ,尝试将t对象的属性值复制到当前ForumEntity对象中,
|
|
|
//// 通过BeanUtils进行属性复制
|
|
|
// ,若出现异常则打印堆栈信息,可用于基于已有对象来初始化该实体对象的场景。
|
|
|
public ForumEntity(T t) {
|
|
|
try {
|
|
|
BeanUtils.copyProperties(this, t);
|
|
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//**
|
|
|
//* 主键
|
|
|
// * 对应数据库表中记录的唯一标识符,
|
|
|
* 使用了MyBatis Plus的注解来指定主键的相关配置,
|
|
|
* 如设置主键生成策略为自增长(IdType.AUTO),
|
|
|
* 并指定了数据库表中的字段名为"id"。
|
|
|
*/
|
|
|
@TableId(type = IdType.AUTO)
|
|
|
@TableField(value = "id")
|
|
|
private Integer id;
|
|
|
|
|
|
// /**
|
|
|
// * 帖子标题
|
|
|
// * 用于存储论坛帖子的标题信息,
|
|
|
// * 通过@TableField注解指定了在数据库表"forum"中对应的字段名为"forum_name"。
|
|
|
*/
|
|
|
@TableField(value = "forum_name")
|
|
|
private String forumName;
|
|
|
|
|
|
/**
|
|
|
* 用户
|
|
|
// * 用于存储发布该帖子的用户的唯一标识(可能关联到用户表中的用户ID),
|
|
|
// * 通过@TableField注解指定了在数据库表"forum"中对应的字段名为"yonghu_id"。
|
|
|
// */
|
|
|
@TableField(value = "yonghu_id")
|
|
|
private Integer yonghuId;
|
|
|
|
|
|
/**
|
|
|
// * 管理员
|
|
|
//* 用于存储与该帖子相关的管理员用户的唯一标识(可能在一些管理操作或权限相关场景中有作用),
|
|
|
// * 通过@TableField注解指定了在数据库表"forum"中对应的字段名为"users_id"。
|
|
|
//*/
|
|
|
@TableField(value = "users_id")
|
|
|
private Integer usersId;
|
|
|
|
|
|
// /**
|
|
|
//* 发布内容
|
|
|
// * 用于存储论坛帖子的具体内容信息,通过@TableField注解指定了在数据库表"forum"中对应的字段名为"forum_content"。
|
|
|
//*/
|
|
|
@TableField(value = "forum_content")
|
|
|
private String forumContent;
|
|
|
|
|
|
// /**
|
|
|
// * 父id
|
|
|
// * 可能用于表示帖子之间的层级关系(比如回复帖子时关联到原帖子的ID等情况),
|
|
|
//* 通过@TableField注解指定了在数据库表"forum"中对应的字段名为"super_ids"。
|
|
|
// */
|
|
|
@TableField(value = "super_ids")
|
|
|
private Integer superIds;
|
|
|
|
|
|
// /**
|
|
|
//* 帖子状态
|
|
|
// * 用于存储帖子当前所处的状态信息(例如审核状态、是否可见等不同状态,具体含义由业务定义),
|
|
|
//* 通过@TableField注解指定了在数据库表"forum"中对应的字段名为"forum_state_types"。
|
|
|
//*/
|
|
|
@TableField(value = "forum_state_types")
|
|
|
private Integer forumStateTypes;
|
|
|
|
|
|
///**
|
|
|
// * 发帖时间
|
|
|
//* 用于记录帖子发布的时间,使用了@JsonFormat注解来指定时间格式化的相关配置,如设置时区、格式化模式等,
|
|
|
// * 使其在序列化为JSON等格式时能以指定格式展示时间,同时通过@DateTimeFormat注解用于在接收前端传入时间格式数据时进行解析,
|
|
|
// * 并且通过@TableField注解指定了该字段在数据库表"forum"中对应的字段名为"insert_time"以及其填充策略为插入时自动填充(FieldFill.INSERT)。
|
|
|
// */
|
|
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
@DateTimeFormat
|
|
|
@TableField(value = "insert_time", fill = FieldFill.INSERT)
|
|
|
private Date insertTime;
|
|
|
|
|
|
// /**
|
|
|
// * 修改时间
|
|
|
//* 用于记录帖子最后一次被修改的时间,同样使用了@JsonFormat和@DateTimeFormat注解来处理时间的格式化和解析,
|
|
|
//* 通过@TableField注解指定了该字段在数据库表"forum"中对应的字段名为"update_time"以及其填充策略为更新时自动填充(FieldFill.UPDATE)。
|
|
|
// */
|
|
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
@DateTimeFormat
|
|
|
@TableField(value = "update_time", fill = FieldFill.UPDATE)
|
|
|
private Date updateTime;
|
|
|
|
|
|
///**
|
|
|
//* 创建时间
|
|
|
//* 用于记录帖子相关记录在系统中创建的时间,使用了@JsonFormat和@DateTimeFormat注解来处理时间的格式化和解析,
|
|
|
//* 通过@TableField注解指定了该字段在数据库表"forum"中对应的字段名为"create_time"以及其填充策略为插入时自动填充(FieldFill.INSERT)。
|
|
|
// */
|
|
|
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
@DateTimeFormat
|
|
|
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
|
|
private Date createTime;
|
|
|
|
|
|
///**
|
|
|
//* 设置:主键
|
|
|
//* Getter方法,用于获取主键id的值,外部代码可以通过该方法获取当前ForumEntity对象的主键值。
|
|
|
//*/
|
|
|
public Integer getId() {
|
|
|
return id;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
//* 获取:主键
|
|
|
//* Setter方法,用于设置主键id的值,外部代码可以通过该方法来修改当前ForumEntity对象的主键值。
|
|
|
//*/
|
|
|
public void setId(Integer id) {
|
|
|
this.id = id;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
// * 设置:帖子标题
|
|
|
//* Getter方法,用于获取帖子标题forumName的值,外部代码可以通过该方法获取当前ForumEntity对象的帖子标题。
|
|
|
// */
|
|
|
public String getForumName() {
|
|
|
return forumName;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
// * 获取:帖子标题
|
|
|
//* Setter方法,用于设置帖子标题forumName的值,外部代码可以通过该方法来修改当前ForumEntity对象的帖子标题。
|
|
|
//*/
|
|
|
public void setForumName(String forumName) {
|
|
|
this.forumName = forumName;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
// * 设置:用户
|
|
|
//* Getter方法,用于获取用户ID(yonghuId)的值,外部代码可以通过该方法获取当前ForumEntity对象所关联的用户标识。
|
|
|
//*/
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
public Integer getYonghuId() {
|
|
|
return yonghuId;
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
//* 获取:用户
|
|
|
//* Setter方法,用于设置用户ID(yonghuId)的值,外部代码可以通过该方法来修改当前ForumEntity对象所关联的用户标识。
|
|
|
//*/
|
|
|
public void setYonghuId(Integer yonghuId) {
|
|
|
this.yonghuId = yonghuId;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
//* 设置:管理员
|
|
|
// * Getter方法,用于获取管理员用户ID(usersId)的值,外部代码可以通过该方法获取当前ForumEntity对象所关联的管理员标识。
|
|
|
//*/
|
|
|
public Integer getUsersId() {
|
|
|
return usersId;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
// * 获取:管理员
|
|
|
// * Setter方法,用于设置管理员用户ID(usersId)的值,外部代码可以通过该方法来修改当前ForumEntity对象所关联的管理员标识。
|
|
|
// */
|
|
|
public void setUsersId(Integer usersId) {
|
|
|
this.usersId = usersId;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
//* 设置:发布内容
|
|
|
//* Getter方法,用于获取帖子发布内容(forumContent)的值,外部代码可以通过该方法获取当前ForumEntity对象的帖子具体内容。
|
|
|
//*/
|
|
|
public String getForumContent() {
|
|
|
return forumContent;
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
//* 获取:发布内容
|
|
|
//* Setter方法,用于设置帖子发布内容(forumContent)的值,外部代码可以通过该方法来修改当前ForumEntity对象的帖子具体内容。
|
|
|
//*/
|
|
|
public void setForumContent(String forumContent) {
|
|
|
this.forumContent = forumContent;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
//* 设置:父id
|
|
|
//* Getter方法,用于获取父ID(superIds)的值,外部代码可以通过该方法获取当前ForumEntity对象所关联的父级帖子标识(如果有层级关系的话)。
|
|
|
// */
|
|
|
public Integer getSuperIds() {
|
|
|
return superIds;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
// * 获取:父id
|
|
|
//* Setter方法,用于设置父ID(superIds)的值,外部代码可以通过该方法来修改当前ForumEntity对象所关联的父级帖子标识(如果有层级关系的话)。
|
|
|
// */
|
|
|
public void setSuperIds(Integer superIds) {
|
|
|
this.superIds = superIds;
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
// * 设置:帖子状态
|
|
|
//* Getter方法,用于获取帖子状态(forumStateTypes)的值,外部代码可以通过该方法获取当前ForumEntity对象的帖子当前状态信息。
|
|
|
//*/
|
|
|
public Integer getForumStateTypes() {
|
|
|
return forumStateTypes;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
// * 获取:帖子状态
|
|
|
// * Setter方法,用于设置帖子状态(forumStateTypes)的值,外部代码可以通过该方法来修改当前ForumEntity对象的帖子当前状态信息。
|
|
|
//*/
|
|
|
public void setForumStateTypes(Integer forumStateTypes) {
|
|
|
this.forumStateTypes = forumStateTypes;
|
|
|
}
|
|
|
|
|
|
//**
|
|
|
//* 设置:发帖时间
|
|
|
// * Getter方法,用于获取发帖时间(insertTime)的值,外部代码可以通过该方法获取当前ForumEntity对象的帖子发布时间信息。
|
|
|
// */
|
|
|
public Date getInsertTime() {
|
|
|
return insertTime;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
//* 获取:发帖时间
|
|
|
////* Setter方法,用于设置发帖时间(insertTime)的值,外部代码可以通过该方法来修改当前ForumEntity对象的帖子发布时间信息。
|
|
|
//*/
|
|
|
public void setInsertTime(Date insertTime) {
|
|
|
this.insertTime = insertTime;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
// * 设置:修改时间
|
|
|
//* Getter方法,用于获取修改时间(updateTime)的值,外部代码可以通过该方法获取当前ForumEntity对象的帖子最后修改时间信息。
|
|
|
// */
|
|
|
public Date getUpdateTime() {
|
|
|
return updateTime;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
//* 获取:修改时间
|
|
|
//* Setter方法,用于设置修改时间(updateTime)的值,外部代码可以通过该方法来修改当前ForumEntity对象的帖子最后修改时间信息。
|
|
|
// */
|
|
|
public void setUpdateTime(Date updateTime) {
|
|
|
this.updateTime = updateTime;
|
|
|
}
|
|
|
|
|
|
///**
|
|
|
// * 设置:创建时间
|
|
|
// * Getter方法,用于获取创建时间(createTime)的值,外部代码可以通过该方法获取当前ForumEntity对象的帖子相关记录创建时间信息。
|
|
|
// */
|
|
|
public Date getCreateTime() {
|
|
|
return createTime;
|
|
|
}
|
|
|
|
|
|
// /**
|
|
|
// * 获取:创建时间
|
|
|
//* Setter方法,用于设置创建时间(createTime)的值,外部代码可以通过该方法来修改当前ForumEntity对象的帖子相关记录创建时间信息。
|
|
|
// */
|
|
|
public void setCreateTime(Date createTime) {
|
|
|
this.createTime = createTime;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String toString() {
|
|
|
return "Forum{" +
|
|
|
"id=" + id +
|
|
|
", forumName=" + forumName +
|
|
|
", yonghuId=" + yonghuId +
|
|
|
", usersId=" + usersId +
|
|
|
", forumContent=" + forumContent +
|
|
|
", superIds=" + superIds +
|
|
|
", forumStateTypes=" + forumStateTypes +
|
|
|
", insertTime=" + insertTime +
|
|
|
", updateTime=" + updateTime +
|
|
|
", createTime=" + createTime +
|
|
|
"}";
|
|
|
}
|
|
|
} |