|
|
|
@ -1,195 +1,170 @@
|
|
|
|
|
package com.entity;
|
|
|
|
|
|
|
|
|
|
import com.annotation.ColumnInfo;
|
|
|
|
|
import javax.validation.constraints.*;
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import org.apache.tools.ant.util.DateUtils;
|
|
|
|
|
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.annotations.TableId;
|
|
|
|
|
import com.baomidou.mybatisplus.annotations.TableName;
|
|
|
|
|
import com.baomidou.mybatisplus.enums.IdType;
|
|
|
|
|
import com.baomidou.mybatisplus.enums.FieldFill;
|
|
|
|
|
import com.utils.DateUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 课程收藏
|
|
|
|
|
*
|
|
|
|
|
* @author
|
|
|
|
|
* @email
|
|
|
|
|
*/
|
|
|
|
|
@TableName("jianshenkecheng_collection")
|
|
|
|
|
public class JianshenkechengCollectionEntity<T> implements Serializable {
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JianshenkechengCollectionEntity() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JianshenkechengCollectionEntity(T t) {
|
|
|
|
|
try {
|
|
|
|
|
BeanUtils.copyProperties(this, t);
|
|
|
|
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 主键
|
|
|
|
|
*/
|
|
|
|
|
@TableId(type = IdType.AUTO)
|
|
|
|
|
@ColumnInfo(comment="主键",type="int(11)")
|
|
|
|
|
@TableField(value = "id")
|
|
|
|
|
|
|
|
|
|
private Integer id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 健身课程
|
|
|
|
|
*/
|
|
|
|
|
@ColumnInfo(comment="健身课程",type="int(11)")
|
|
|
|
|
@TableField(value = "jianshenkecheng_id")
|
|
|
|
|
|
|
|
|
|
private Integer jianshenkechengId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户
|
|
|
|
|
*/
|
|
|
|
|
@ColumnInfo(comment="用户",type="int(11)")
|
|
|
|
|
@TableField(value = "yonghu_id")
|
|
|
|
|
|
|
|
|
|
private Integer yonghuId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 类型
|
|
|
|
|
*/
|
|
|
|
|
@ColumnInfo(comment="类型",type="int(11)")
|
|
|
|
|
@TableField(value = "jianshenkecheng_collection_types")
|
|
|
|
|
|
|
|
|
|
private Integer jianshenkechengCollectionTypes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 收藏时间
|
|
|
|
|
*/
|
|
|
|
|
@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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取:主键
|
|
|
|
|
*/
|
|
|
|
|
public Integer getId() {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 设置:主键
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void setId(Integer id) {
|
|
|
|
|
this.id = id;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取:健身课程
|
|
|
|
|
*/
|
|
|
|
|
public Integer getJianshenkechengId() {
|
|
|
|
|
return jianshenkechengId;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 设置:健身课程
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void setJianshenkechengId(Integer jianshenkechengId) {
|
|
|
|
|
this.jianshenkechengId = jianshenkechengId;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取:用户
|
|
|
|
|
*/
|
|
|
|
|
public Integer getYonghuId() {
|
|
|
|
|
return yonghuId;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 设置:用户
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void setYonghuId(Integer yonghuId) {
|
|
|
|
|
this.yonghuId = yonghuId;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取:类型
|
|
|
|
|
*/
|
|
|
|
|
public Integer getJianshenkechengCollectionTypes() {
|
|
|
|
|
return jianshenkechengCollectionTypes;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 设置:类型
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public void setJianshenkechengCollectionTypes(Integer jianshenkechengCollectionTypes) {
|
|
|
|
|
this.jianshenkechengCollectionTypes = jianshenkechengCollectionTypes;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取:收藏时间
|
|
|
|
|
*/
|
|
|
|
|
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 "JianshenkechengCollection{" +
|
|
|
|
|
", id=" + id +
|
|
|
|
|
", jianshenkechengId=" + jianshenkechengId +
|
|
|
|
|
", yonghuId=" + yonghuId +
|
|
|
|
|
", jianshenkechengCollectionTypes=" + jianshenkechengCollectionTypes +
|
|
|
|
|
", insertTime=" + DateUtil.convertString(insertTime,"yyyy-MM-dd") +
|
|
|
|
|
", createTime=" + DateUtil.convertString(createTime,"yyyy-MM-dd") +
|
|
|
|
|
"}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 包声明:实体类包,存放所有与数据库表映射的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;
|
|
|
|
|
// MyBatis Plus主键策略枚举
|
|
|
|
|
import com.baomidou.mybatisplus.enums.IdType;
|
|
|
|
|
// MyBatis Plus字段填充策略枚举
|
|
|
|
|
import com.baomidou.mybatisplus.enums.FieldFill;
|
|
|
|
|
// 自定义日期工具类
|
|
|
|
|
import com.utils.DateUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@TableName("jianshenkecheng_collection") // 指定关联数据库表名
|
|
|
|
|
public class JianshenkechengCollectionEntity<T> implements Serializable {
|
|
|
|
|
// 序列化版本UID(类版本控制)
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
// 空参构造器(JPA/MyBatis等框架需要)
|
|
|
|
|
public JianshenkechengCollectionEntity() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 泛型构造器:通过反射将泛型对象属性拷贝到当前实体
|
|
|
|
|
public JianshenkechengCollectionEntity(T t) {
|
|
|
|
|
try {
|
|
|
|
|
// 使用Apache BeanUtils进行属性拷贝
|
|
|
|
|
BeanUtils.copyProperties(this, t);
|
|
|
|
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
|
|
|
|
// 异常处理(建议生产环境改为日志记录)
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 主键字段
|
|
|
|
|
@TableId(type = IdType.AUTO) // 主键自增策略
|
|
|
|
|
@ColumnInfo(comment="主键",type="int(11)") // 字段注释:主键,数据库类型int(11)
|
|
|
|
|
@TableField(value = "id") // 映射数据库字段名(可省略,默认驼峰转下划线)
|
|
|
|
|
private Integer id;
|
|
|
|
|
|
|
|
|
|
// 关联健身课程ID(外键)
|
|
|
|
|
@ColumnInfo(comment="健身课程",type="int(11)") // 字段注释:关联健身课程表
|
|
|
|
|
@TableField(value = "jianshenkecheng_id") // 数据库字段名
|
|
|
|
|
private Integer jianshenkechengId;
|
|
|
|
|
|
|
|
|
|
// 关联用户ID(外键)
|
|
|
|
|
@ColumnInfo(comment="用户",type="int(11)") // 字段注释:关联用户表
|
|
|
|
|
@TableField(value = "yonghu_id") // 数据库字段名
|
|
|
|
|
private Integer yonghuId;
|
|
|
|
|
|
|
|
|
|
// 收藏类型(需配合字典表或枚举类使用)
|
|
|
|
|
@ColumnInfo(comment="类型",type="int(11)") // 字段注释:1-收藏 2-点赞等类型
|
|
|
|
|
@TableField(value = "jianshenkecheng_collection_types")
|
|
|
|
|
private Integer jianshenkechengCollectionTypes;
|
|
|
|
|
|
|
|
|
|
// 收藏时间(插入时自动填充)
|
|
|
|
|
@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;
|
|
|
|
|
|
|
|
|
|
// 创建时间(与insert_time可能存在冗余)
|
|
|
|
|
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
@ColumnInfo(comment="创建时间",type="timestamp")
|
|
|
|
|
@TableField(value = "create_time",fill = FieldFill.INSERT) // 与insert_time同样使用插入填充,需确认业务需求
|
|
|
|
|
private Date createTime;
|
|
|
|
|
|
|
|
|
|
// Getter/Setter方法
|
|
|
|
|
// ----------------------------
|
|
|
|
|
|
|
|
|
|
// 主键访问器
|
|
|
|
|
public Integer getId() {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 主键修改器
|
|
|
|
|
public void setId(Integer id) {
|
|
|
|
|
this.id = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 健身课程ID访问器
|
|
|
|
|
public Integer getJianshenkechengId() {
|
|
|
|
|
return jianshenkechengId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 健身课程ID修改器
|
|
|
|
|
public void setJianshenkechengId(Integer jianshenkechengId) {
|
|
|
|
|
this.jianshenkechengId = jianshenkechengId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用户ID访问器
|
|
|
|
|
public Integer getYonghuId() {
|
|
|
|
|
return yonghuId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用户ID修改器
|
|
|
|
|
public void setYonghuId(Integer yonghuId) {
|
|
|
|
|
this.yonghuId = yonghuId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 收藏类型访问器
|
|
|
|
|
public Integer getJianshenkechengCollectionTypes() {
|
|
|
|
|
return jianshenkechengCollectionTypes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 收藏类型修改器(建议使用枚举限定值)
|
|
|
|
|
public void setJianshenkechengCollectionTypes(Integer jianshenkechengCollectionTypes) {
|
|
|
|
|
this.jianshenkechengCollectionTypes = jianshenkechengCollectionTypes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 收藏时间访问器
|
|
|
|
|
public Date getInsertTime() {
|
|
|
|
|
return insertTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 收藏时间修改器(通常自动填充,无需手动设置)
|
|
|
|
|
public void setInsertTime(Date insertTime) {
|
|
|
|
|
this.insertTime = insertTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 创建时间访问器
|
|
|
|
|
public Date getCreateTime() {
|
|
|
|
|
return createTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 创建时间修改器(通常自动填充,需确认与insert_time的区别)
|
|
|
|
|
public void setCreateTime(Date createTime) {
|
|
|
|
|
this.createTime = createTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 对象字符串表示(调试用)
|
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
|
|
|
|
return "JianshenkechengCollection{" +
|
|
|
|
|
", id=" + id +
|
|
|
|
|
", jianshenkechengId=" + jianshenkechengId +
|
|
|
|
|
", yonghuId=" + yonghuId +
|
|
|
|
|
", jianshenkechengCollectionTypes=" + jianshenkechengCollectionTypes +
|
|
|
|
|
// 使用自定义工具类格式化日期(注意:格式化为yyyy-MM-dd会丢失时间精度)
|
|
|
|
|
", insertTime=" + DateUtil.convertString(insertTime,"yyyy-MM-dd") +
|
|
|
|
|
", createTime=" + DateUtil.convertString(createTime,"yyyy-MM-dd") +
|
|
|
|
|
"}";
|
|
|
|
|
}
|
|
|
|
|
}
|