顾士鑫注释 #10

Merged
pxwi83ejl merged 1 commits from edu/User into develop 1 year ago

@ -1,164 +1,166 @@
// 声明当前类所属的包为com.entity用于组织和管理实体类
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解用于标识数据库表的主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解指定当前实体类对应的数据库表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解,当前类未使用,保留导入以备扩展
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数中属性复制的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化便于网络传输或持久化存储
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于定义日期类型的字段
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解确保前端与后端日期参数的格式统一
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类用于配置主键生成策略
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*
* chat
*
*/
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为chat
@TableName("chat")
// 定义泛型实体类ChatEntity实现Serializable接口以支持对象的序列化和反序列化
public class ChatEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性(建议与类结构变更时同步更新)
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建空的实体对象(满足框架反射创建对象的需求)
public ChatEntity() {
}
// 带参构造函数接收泛型对象t用于将t的属性复制到当前实体对象
public ChatEntity(T t) {
// 尝试使用BeanUtils工具类复制对象属性
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息(开发阶段临时处理,生产环境可自定义异常处理逻辑)
e.printStackTrace();
}
}
/**
* id
*/
@TableId
// 标记为主键字段指定主键生成策略为数据库自增AUTO
@TableId(type = IdType.AUTO)
// 定义Long类型的id字段用于存储数据库表的主键值唯一标识一条聊天记录
private Long id;
/**
* id
*/
// 定义Long类型的userid字段用于存储发起聊天的用户ID外键关联用户表
private Long userid;
/**
* id
*/
// 定义Long类型的adminid字段用于存储回复聊天的管理员ID外键关联管理员表
private Long adminid;
/**
*
*/
// 定义String类型的ask字段用于存储用户的提问内容
private String ask;
/**
*
*/
// 定义String类型的reply字段用于存储管理员的回复内容可为空
private String reply;
/**
*
*/
// 定义Integer类型的isreply字段用于标识是否已回复0表示未回复1表示已回复
private Integer isreply;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
// 使用Jackson注解指定日期在JSON中的格式时区为GMT+8格式为"yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// 定义Date类型的addtime字段用于存储聊天记录的创建时间
private Date addtime;
// ------------------------- Getter 和 Setter 方法 -------------------------
// 获取聊天记录创建时间的方法
public Date getAddtime() {
return addtime;
}
// 设置聊天记录创建时间的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取主键ID的方法
public Long getId() {
return id;
}
// 设置主键ID的方法通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
this.id = id;
}
/**
* id
*/
// 设置用户ID的方法
public void setUserid(Long userid) {
this.userid = userid;
}
/**
* id
*/
// 获取用户ID的方法
public Long getUserid() {
return userid;
}
/**
* id
*/
// 设置管理员ID的方法
public void setAdminid(Long adminid) {
this.adminid = adminid;
}
/**
* id
*/
// 获取管理员ID的方法
public Long getAdminid() {
return adminid;
}
/**
*
*/
// 设置用户提问内容的方法
public void setAsk(String ask) {
this.ask = ask;
}
/**
*
*/
// 获取用户提问内容的方法
public String getAsk() {
return ask;
}
/**
*
*/
// 设置管理员回复内容的方法
public void setReply(String reply) {
this.reply = reply;
}
/**
*
*/
// 获取管理员回复内容的方法
public String getReply() {
return reply;
}
/**
*
*/
// 设置是否回复状态的方法0未回复1已回复
public void setIsreply(Integer isreply) {
this.isreply = isreply;
}
/**
*
*/
// 获取是否回复状态的方法
public Integer getIsreply() {
return isreply;
}
}
}

@ -1,53 +1,67 @@
// 声明当前类所属的包为com.entity用于组织和管理实体类
package com.entity;
// 导入Java序列化接口使当前类支持对象序列化便于网络传输或持久化存储
import java.io.Serializable;
// 导入MyBatis-Plus框架中用于标记主键的注解用于标识数据库表的主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解指定当前实体类对应的数据库表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类用于配置主键生成策略
import com.baomidou.mybatisplus.enums.IdType;
/**
* :
*/
*
* config
*/
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为config
@TableName("config")
public class ConfigEntity implements Serializable{
private static final long serialVersionUID = 1L;
// 定义ConfigEntity类实现Serializable接口以支持对象的序列化和反序列化
public class ConfigEntity implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性(建议与类结构变更时同步更新)
private static final long serialVersionUID = 1L;
// 标记为主键字段指定主键生成策略为数据库自增AUTO
@TableId(type = IdType.AUTO)
// 定义Long类型的id字段用于存储数据库表的主键值唯一标识一条配置记录
private Long id;
/**
* key
*/
private String name;
/**
* value
*/
private String value;
// 定义String类型的name字段用于存储配置项的键名唯一标识符
private String name; // 配置项的唯一键名,如"site_name"、"upload_path"等
// 定义String类型的value字段用于存储配置项对应的参数值
private String value; // 配置项的值,如具体的配置内容或路径
// ------------------------- Getter 和 Setter 方法 -------------------------
// 获取主键ID的方法返回数据库自动生成的主键值
public Long getId() {
return id;
}
// 设置主键ID的方法通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
this.id = id;
}
// 获取配置项键名的方法,返回配置项的唯一标识符
public String getName() {
return name;
}
// 设置配置项键名的方法,用于设置配置项的唯一标识符
public void setName(String name) {
this.name = name;
}
// 获取配置项值的方法,返回配置项对应的参数值
public String getValue() {
return value;
}
// 设置配置项值的方法,用于设置配置项对应的参数值
public void setValue(String value) {
this.value = value;
}
}
}

@ -1,164 +1,181 @@
// 声明该类所在的包为com.entity用于组织和管理相关实体类
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解用于标识数据库表的主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解指定当前实体类对应的数据库表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空字符串去除首尾空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时某些属性的注解当前类未使用保留导入以备扩展
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类用于带参构造函数中属性复制时的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类使当前类支持对象序列化便于网络传输或持久化存储
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类用于定义日期类型的字段
import java.util.Date;
// 导入Java中用于处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于格式化日期的注解用于前端与后端日期格式的统一转换
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于带参构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 课程信息评论表
// 数据库通用操作实体类(普通增删改查),用于存储课程信息的评论及回复相关数据
// @author
// @email
// @date 2021-05-09 15:46:15
// 使用MyBatis-Plus的注解指定该实体类对应的数据库表名为discusskechengxinxi
@TableName("discusskechengxinxi")
// 定义一个泛型类DiscusskechengxinxiEntity实现Serializable接口以支持对象的序列化
public class DiscusskechengxinxiEntity<T> implements Serializable {
private static final long serialVersionUID = 1L;
public DiscusskechengxinxiEntity() {
}
public DiscusskechengxinxiEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* id
*/
@TableId
private Long id;
/**
* id
*/
private Long refid;
/**
* id
*/
private Long userid;
/**
*
*/
private String nickname;
/**
*
*/
private String content;
/**
*
*/
private String reply;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date addtime;
public Date getAddtime() {
return addtime;
}
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
* id
*/
public void setRefid(Long refid) {
this.refid = refid;
}
/**
* id
*/
public Long getRefid() {
return refid;
}
/**
* id
*/
public void setUserid(Long userid) {
this.userid = userid;
}
/**
* id
*/
public Long getUserid() {
return userid;
}
/**
*
*/
public void setNickname(String nickname) {
this.nickname = nickname;
}
/**
*
*/
public String getNickname() {
return nickname;
}
/**
*
*/
public void setContent(String content) {
this.content = content;
}
/**
*
*/
public String getContent() {
return content;
}
/**
*
*/
public void setReply(String reply) {
this.reply = reply;
}
/**
*
*/
public String getReply() {
return reply;
}
}
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致性,建议与类结构变更时同步更新
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的DiscusskechengxinxiEntity对象满足框架反射创建对象的需求
public DiscusskechengxinxiEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public DiscusskechengxinxiEntity(T t) {
try {
// 使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// 打印异常堆栈信息,开发阶段临时处理,生产环境可自定义异常处理逻辑
e.printStackTrace();
}
}
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键唯一标识一条评论记录
private Long id;
// 关联表id
// 定义一个Long类型的属性refid用于存储关联表的id通常关联课程信息表的主键
private Long refid;
// 用户id
// 定义一个Long类型的属性userid用于存储发表评论的用户的id关联用户表的主键
private Long userid;
// 用户名
// 定义一个String类型的属性nickname用于存储发表评论的用户的昵称
private String nickname;
// 评论内容
// 定义一个String类型的属性content用于存储用户对课程信息的评论内容
private String content;
// 回复内容
// 定义一个String类型的属性reply用于存储管理员或其他用户对该评论的回复内容
private String reply;
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式确保前端传入的日期格式正确解析
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储评论的添加时间
private Date addtime;
// 获取addtime属性的方法返回评论的添加时间
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法用于设置评论的添加时间
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法返回评论记录的主键
public Long getId() {
return id;
}
// 设置id属性的方法通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
this.id = id;
}
// 设置关联表id
// 设置refid属性的方法用于设置关联课程信息表的主键
public void setRefid(Long refid) {
this.refid = refid;
}
// 获取关联表id
// 获取refid属性的方法返回关联课程信息表的主键
public Long getRefid() {
return refid;
}
// 设置用户id
// 设置userid属性的方法用于设置发表评论的用户的id
public void setUserid(Long userid) {
this.userid = userid;
}
// 获取用户id
// 获取userid属性的方法返回发表评论的用户的id
public Long getUserid() {
return userid;
}
// 设置:用户名
// 设置nickname属性的方法用于设置发表评论的用户的昵称
public void setNickname(String nickname) {
this.nickname = nickname;
}
// 获取:用户名
// 获取nickname属性的方法返回发表评论的用户的昵称
public String getNickname() {
return nickname;
}
// 设置:评论内容
// 设置content属性的方法用于设置用户对课程信息的评论内容
public void setContent(String content) {
this.content = content;
}
// 获取:评论内容
// 获取content属性的方法返回用户对课程信息的评论内容
public String getContent() {
return content;
}
// 设置:回复内容
// 设置reply属性的方法用于设置管理员或其他用户对该评论的回复内容
public void setReply(String reply) {
this.reply = reply;
}
// 获取:回复内容
// 获取reply属性的方法返回管理员或其他用户对该评论的回复内容
public String getReply() {
return reply;
}
}

@ -1,52 +1,72 @@
// 声明该类所在的包为com.entity
package com.entity;
/**
*
*/
// 定义一个名为EIException的自定义异常类继承自RuntimeException
public class EIException extends RuntimeException {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致性
private static final long serialVersionUID = 1L;
private String msg;
private int code = 500;
public EIException(String msg) {
// 定义一个字符串类型的属性msg用于存储异常信息
private String msg;
// 定义一个整数类型的属性code用于存储异常状态码默认值为500
private int code = 500;
// 定义一个构造函数接收一个字符串类型的参数msg用于创建异常对象
public EIException(String msg) {
// 调用父类的构造函数,传入异常信息
super(msg);
// 将传入的异常信息赋值给当前对象的msg属性
this.msg = msg;
}
// 定义一个构造函数接收一个字符串类型的参数msg和一个Throwable类型的参数e用于创建异常对象
public EIException(String msg, Throwable e) {
// 调用父类的构造函数,传入异常信息和异常原因
super(msg, e);
// 将传入的异常信息赋值给当前对象的msg属性
this.msg = msg;
}
// 定义一个构造函数接收一个字符串类型的参数msg和一个整数类型的参数code用于创建异常对象
public EIException(String msg, int code) {
// 调用父类的构造函数,传入异常信息
super(msg);
// 将传入的异常信息赋值给当前对象的msg属性
this.msg = msg;
// 将传入的异常状态码赋值给当前对象的code属性
this.code = code;
}
// 定义一个构造函数接收一个字符串类型的参数msg、一个整数类型的参数code和一个Throwable类型的参数e用于创建异常对象
public EIException(String msg, int code, Throwable e) {
// 调用父类的构造函数,传入异常信息和异常原因
super(msg, e);
// 将传入的异常信息赋值给当前对象的msg属性
this.msg = msg;
// 将传入的异常状态码赋值给当前对象的code属性
this.code = code;
}
// 获取msg属性的方法
public String getMsg() {
return msg;
}
// 设置msg属性的方法
public void setMsg(String msg) {
this.msg = msg;
}
// 获取code属性的方法
public int getCode() {
return code;
}
// 设置code属性的方法
public void setCode(int code) {
this.code = code;
}
}
}

@ -1,128 +1,150 @@
// 声明该类所在的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空字符串的注解
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时的某些属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类
import java.util.Date;
// 导入Java中用于处理列表集合的接口
import java.util.List;
// 导入Spring框架中用于格式化日期的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 试卷表
// 数据库通用操作实体类(普通增删改查)
// @author
// @email
// @date 2021-05-09 15:46:15
// 使用MyBatis-Plus的注解指定该实体类对应的数据库表名为exampaper
@TableName("exampaper")
// 定义一个泛型类ExampaperEntity实现Serializable接口以支持对象的序列化
public class ExampaperEntity<T> implements Serializable {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致性
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的ExampaperEntity对象
public ExampaperEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public ExampaperEntity(T t) {
try {
// 使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// TODO Auto-generated catch block
// 打印异常堆栈信息
e.printStackTrace();
}
}
/**
* id
*/
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键
private Long id;
/**
*
*/
// 试卷名称
// 定义一个String类型的属性name用于存储试卷名称
private String name;
/**
* ()
*/
// 考试时长(分钟)
// 定义一个Integer类型的属性time用于存储考试时长
private Integer time;
/**
*
*/
// 试卷状态
// 定义一个Integer类型的属性status用于存储试卷状态
private Integer status;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储添加时间
private Date addtime;
// 获取addtime属性的方法
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法
public Long getId() {
return id;
}
// 设置id属性的方法
public void setId(Long id) {
this.id = id;
}
/**
*
*/
// 设置:试卷名称
// 设置name属性的方法
public void setName(String name) {
this.name = name;
}
/**
*
*/
// 获取:试卷名称
// 获取name属性的方法
public String getName() {
return name;
}
/**
* ()
*/
// 设置:考试时长(分钟)
// 设置time属性的方法
public void setTime(Integer time) {
this.time = time;
}
/**
* ()
*/
// 获取:考试时长(分钟)
// 获取time属性的方法
public Integer getTime() {
return time;
}
/**
*
*/
// 设置:试卷状态
// 设置status属性的方法
public void setStatus(Integer status) {
this.status = status;
}
/**
*
*/
// 获取:试卷状态
// 获取status属性的方法
public Integer getStatus() {
return status;
}
}
}

@ -1,236 +1,247 @@
// 声明该类所在的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空字符串的注解
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时的某些属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类
import java.util.Date;
// 导入Java中用于处理列表集合的接口
import java.util.List;
// 导入Spring框架中用于格式化日期的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 试题表
// 数据库通用操作实体类(普通增删改查)
// @author
// @email
// @date 2021-05-09 15:46:15
// 使用MyBatis-Plus的注解指定该实体类对应的数据库表名为examquestion
@TableName("examquestion")
// 定义一个泛型类ExamquestionEntity实现Serializable接口以支持对象的序列化
public class ExamquestionEntity<T> implements Serializable {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致性
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的ExamquestionEntity对象
public ExamquestionEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public ExamquestionEntity(T t) {
// 尝试使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
try {
// 使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// TODO Auto-generated catch block
// 打印异常堆栈信息
e.printStackTrace();
}
}
/**
* id
*/
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键
private Long id;
/**
* id
*/
// 所属试卷id外键
// 定义一个Long类型的属性paperid用于存储所属试卷的id
private Long paperid;
/**
*
*/
// 试卷名称
// 定义一个String类型的属性papername用于存储试卷的名称
private String papername;
/**
*
*/
// 试题名称
// 定义一个String类型的属性questionname用于存储试题的名称
private String questionname;
/**
* json
*/
// 选项json字符串
// 定义一个String类型的属性options用于存储试题的选项以JSON字符串形式保存
private String options;
/**
*
*/
// 分值
// 定义一个Long类型的属性score用于存储试题的分值
private Long score;
/**
*
*/
// 正确答案
// 定义一个String类型的属性answer用于存储试题的正确答案
private String answer;
/**
*
*/
// 答案解析
// 定义一个String类型的属性analysis用于存储试题答案的解析
private String analysis;
/**
* 0 1 2 3
*/
// 试题类型0单选题 1多选题 2判断题 3填空题暂不考虑多项填空
// 定义一个Long类型的属性type用于存储试题的类型
private Long type;
/**
*
*/
// 试题排序,值越大排越前面
// 定义一个Long类型的属性sequence用于存储试题的排序信息
private Long sequence;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储试题的添加时间
private Date addtime;
// 获取addtime属性的方法
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法
public Long getId() {
return id;
}
// 设置id属性的方法
public void setId(Long id) {
this.id = id;
}
/**
* id
*/
// 设置所属试卷id外键
// 设置paperid属性的方法
public void setPaperid(Long paperid) {
this.paperid = paperid;
}
/**
* id
*/
// 获取所属试卷id外键
// 获取paperid属性的方法
public Long getPaperid() {
return paperid;
}
/**
*
*/
// 设置:试卷名称
// 设置papername属性的方法
public void setPapername(String papername) {
this.papername = papername;
}
/**
*
*/
// 获取:试卷名称
// 获取papername属性的方法
public String getPapername() {
return papername;
}
/**
*
*/
// 设置:试题名称
// 设置questionname属性的方法
public void setQuestionname(String questionname) {
this.questionname = questionname;
}
/**
*
*/
// 获取:试题名称
// 获取questionname属性的方法
public String getQuestionname() {
return questionname;
}
/**
* json
*/
// 设置选项json字符串
// 设置options属性的方法
public void setOptions(String options) {
this.options = options;
}
/**
* json
*/
// 获取选项json字符串
// 获取options属性的方法
public String getOptions() {
return options;
}
/**
*
*/
// 设置:分值
// 设置score属性的方法
public void setScore(Long score) {
this.score = score;
}
/**
*
*/
// 获取:分值
// 获取score属性的方法
public Long getScore() {
return score;
}
/**
*
*/
// 设置:正确答案
// 设置answer属性的方法
public void setAnswer(String answer) {
this.answer = answer;
}
/**
*
*/
// 获取:正确答案
// 获取answer属性的方法
public String getAnswer() {
return answer;
}
/**
*
*/
// 设置:答案解析
// 设置analysis属性的方法
public void setAnalysis(String analysis) {
this.analysis = analysis;
}
/**
*
*/
// 获取:答案解析
// 获取analysis属性的方法
public String getAnalysis() {
return analysis;
}
/**
* 0 1 2 3
*/
// 设置试题类型0单选题 1多选题 2判断题 3填空题暂不考虑多项填空
// 设置type属性的方法
public void setType(Long type) {
this.type = type;
}
/**
* 0 1 2 3
*/
// 获取试题类型0单选题 1多选题 2判断题 3填空题暂不考虑多项填空
// 获取type属性的方法
public Long getType() {
return type;
}
/**
*
*/
// 设置:试题排序,值越大排越前面
// 设置sequence属性的方法
public void setSequence(Long sequence) {
this.sequence = sequence;
}
/**
*
*/
// 获取:试题排序,值越大排越前面
// 获取sequence属性的方法
public Long getSequence() {
return sequence;
}
}
}

@ -1,290 +1,294 @@
// 声明该类所在的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空字符串的注解
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时的某些属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类
import java.util.Date;
// 导入Java中用于处理列表集合的接口
import java.util.List;
// 导入Spring框架中用于格式化日期的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 考试记录表
// 数据库通用操作实体类(普通增删改查)
// @author
// @email
// @date 2021-05-09 15:46:15
// 使用MyBatis-Plus的注解指定该实体类对应的数据库表名为examrecord
@TableName("examrecord")
// 定义一个泛型类ExamrecordEntity实现Serializable接口以支持对象的序列化
public class ExamrecordEntity<T> implements Serializable {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致性
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的ExamrecordEntity对象
public ExamrecordEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public ExamrecordEntity(T t) {
// 尝试使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// TODO: 可根据实际情况完善异常处理逻辑
// 打印异常堆栈信息
e.printStackTrace();
}
}
/**
* id
*/
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键
private Long id;
/**
* id
*/
// 用户id
// 定义一个Long类型的属性userid用于存储用户的id
private Long userid;
/**
*
*/
// 用户名
// 定义一个String类型的属性username用于存储用户名
private String username;
/**
* id
*/
// 试卷id外键
// 定义一个Long类型的属性paperid用于存储试卷的id
private Long paperid;
/**
*
*/
// 试卷名称
// 定义一个String类型的属性papername用于存储试卷的名称
private String papername;
/**
* id
*/
// 试题id外键
// 定义一个Long类型的属性questionid用于存储试题的id
private Long questionid;
/**
*
*/
// 试题名称
// 定义一个String类型的属性questionname用于存储试题的名称
private String questionname;
/**
* json
*/
// 选项json字符串
// 定义一个String类型的属性options用于存储试题的选项以JSON字符串形式保存
private String options;
/**
*
*/
// 分值
// 定义一个Long类型的属性score用于存储试题的分值
private Long score;
/**
*
*/
// 正确答案
// 定义一个String类型的属性answer用于存储试题的正确答案
private String answer;
/**
*
*/
// 答案解析
// 定义一个String类型的属性analysis用于存储试题答案的解析
private String analysis;
/**
*
*/
// 试题得分
// 定义一个Long类型的属性myscore用于存储考生在该试题上的得分
private Long myscore;
/**
*
*/
// 考生答案
// 定义一个String类型的属性myanswer用于存储考生给出的答案
private String myanswer;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储考试记录的添加时间
private Date addtime;
// 获取addtime属性的方法
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法
public Long getId() {
return id;
}
// 设置id属性的方法
public void setId(Long id) {
this.id = id;
}
/**
* id
*/
// 设置用户id
// 设置userid属性的方法
public void setUserid(Long userid) {
this.userid = userid;
}
/**
* id
*/
// 获取用户id
// 获取userid属性的方法
public Long getUserid() {
return userid;
}
/**
*
*/
// 设置:用户名
// 设置username属性的方法
public void setUsername(String username) {
this.username = username;
}
/**
*
*/
// 获取:用户名
// 获取username属性的方法
public String getUsername() {
return username;
}
/**
* id
*/
// 设置试卷id外键
// 设置paperid属性的方法
public void setPaperid(Long paperid) {
this.paperid = paperid;
}
/**
* id
*/
// 获取试卷id外键
// 获取paperid属性的方法
public Long getPaperid() {
return paperid;
}
/**
*
*/
// 设置:试卷名称
// 设置papername属性的方法
public void setPapername(String papername) {
this.papername = papername;
}
/**
*
*/
// 获取:试卷名称
// 获取papername属性的方法
public String getPapername() {
return papername;
}
/**
* id
*/
// 设置试题id外键
// 设置questionid属性的方法
public void setQuestionid(Long questionid) {
this.questionid = questionid;
}
/**
* id
*/
// 获取试题id外键
// 获取questionid属性的方法
public Long getQuestionid() {
return questionid;
}
/**
*
*/
// 设置:试题名称
// 设置questionname属性的方法
public void setQuestionname(String questionname) {
this.questionname = questionname;
}
/**
*
*/
// 获取:试题名称
// 获取questionname属性的方法
public String getQuestionname() {
return questionname;
}
/**
* json
*/
// 设置选项json字符串
// 设置options属性的方法
public void setOptions(String options) {
this.options = options;
}
/**
* json
*/
// 获取选项json字符串
// 获取options属性的方法
public String getOptions() {
return options;
}
/**
*
*/
// 设置:分值
// 设置score属性的方法
public void setScore(Long score) {
this.score = score;
}
/**
*
*/
// 获取:分值
// 获取score属性的方法
public Long getScore() {
return score;
}
/**
*
*/
// 设置:正确答案
// 设置answer属性的方法
public void setAnswer(String answer) {
this.answer = answer;
}
/**
*
*/
// 获取:正确答案
// 获取answer属性的方法
public String getAnswer() {
return answer;
}
/**
*
*/
// 设置:答案解析
// 设置analysis属性的方法
public void setAnalysis(String analysis) {
this.analysis = analysis;
}
/**
*
*/
// 获取:答案解析
// 获取analysis属性的方法
public String getAnalysis() {
return analysis;
}
/**
*
*/
// 设置:试题得分
// 设置myscore属性的方法
public void setMyscore(Long myscore) {
this.myscore = myscore;
}
/**
*
*/
// 获取:试题得分
// 获取myscore属性的方法
public Long getMyscore() {
return myscore;
}
/**
*
*/
// 设置:考生答案
// 设置myanswer属性的方法
public void setMyanswer(String myanswer) {
this.myanswer = myanswer;
}
/**
*
*/
// 获取:考生答案
// 获取myanswer属性的方法
public String getMyanswer() {
return myanswer;
}
}
}

@ -1,192 +1,198 @@
// 声明该类属于com.entity包
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空串的注解
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时某些属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类
import java.util.Date;
// 导入Java中用于处理列表集合的接口
import java.util.List;
// 导入Spring框架中用于格式化日期的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 表示这是学习交流相关的实体类
// 该类用于数据库的通用操作(普通增删改查)
// 原注释中作者信息、邮箱信息和日期信息缺失
// 使用MyBatis-Plus的注解指定该实体类对应数据库中的forum表
@TableName("forum")
// 定义一个泛型类ForumEntity实现Serializable接口使对象可序列化
public class ForumEntity<T> implements Serializable {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的ForumEntity对象
public ForumEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public ForumEntity(T t) {
// 尝试使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// 这里只是打印异常堆栈信息,可根据实际情况完善异常处理逻辑
e.printStackTrace();
}
}
/**
* id
*/
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键
private Long id;
/**
*
*/
// 帖子标题
// 定义一个String类型的属性title用于存储帖子的标题
private String title;
/**
*
*/
// 帖子内容
// 定义一个String类型的属性content用于存储帖子的内容
private String content;
/**
* id
*/
// 父节点id
// 定义一个Long类型的属性parentid用于存储父节点的id
private Long parentid;
/**
* id
*/
// 用户id
// 定义一个Long类型的属性userid用于存储用户的id
private Long userid;
/**
*
*/
// 用户名
// 定义一个String类型的属性username用于存储用户名
private String username;
/**
*
*/
// 状态
// 定义一个String类型的属性isdone用于存储帖子的状态
private String isdone;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储帖子的添加时间
private Date addtime;
// 获取addtime属性的方法
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法
public Long getId() {
return id;
}
// 设置id属性的方法
public void setId(Long id) {
this.id = id;
}
// 标记该属性不是数据库表中的字段
@TableField(exist = false)
// 定义一个List类型的属性childs用于存储子节点列表
private List<ForumEntity> childs;
// 获取childs属性的方法
public List<ForumEntity> getChilds() {
return childs;
}
// 设置childs属性的方法
public void setChilds(List<ForumEntity> childs) {
this.childs = childs;
}
/**
*
*/
// 设置帖子标题的方法
public void setTitle(String title) {
this.title = title;
}
/**
*
*/
// 获取帖子标题的方法
public String getTitle() {
return title;
}
/**
*
*/
// 设置帖子内容的方法
public void setContent(String content) {
this.content = content;
}
/**
*
*/
// 获取帖子内容的方法
public String getContent() {
return content;
}
/**
* id
*/
// 设置父节点id的方法
public void setParentid(Long parentid) {
this.parentid = parentid;
}
/**
* id
*/
// 获取父节点id的方法
public Long getParentid() {
return parentid;
}
/**
* id
*/
// 设置用户id的方法
public void setUserid(Long userid) {
this.userid = userid;
}
/**
* id
*/
// 获取用户id的方法
public Long getUserid() {
return userid;
}
/**
*
*/
// 设置用户名的方法
public void setUsername(String username) {
this.username = username;
}
/**
*
*/
// 获取用户名的方法
public String getUsername() {
return username;
}
/**
*
*/
// 设置状态的方法
public void setIsdone(String isdone) {
this.isdone = isdone;
}
/**
*
*/
// 获取状态的方法
public String getIsdone() {
return isdone;
}
}
}

@ -1,238 +1,250 @@
// 声明该类所在的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空字符串的注解
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时的某些属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类
import java.util.Date;
// 导入Java中用于处理列表集合的接口
import java.util.List;
// 导入Spring框架中用于格式化日期的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:14
*/
// 购买的课程
// 数据库通用操作实体类(普通增删改查)
// @author
// @email
// @date 2021-05-09 15:46:14
// 使用MyBatis-Plus的注解指定该实体类对应的数据库表名为goumaidekecheng
@TableName("goumaidekecheng")
// 定义一个泛型类GoumaidekechengEntity实现Serializable接口以支持对象的序列化
public class GoumaidekechengEntity<T> implements Serializable {
private static final long serialVersionUID = 1L;
public GoumaidekechengEntity() {
}
public GoumaidekechengEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* id
*/
@TableId
private Long id;
/**
*
*/
private String kechengmingcheng;
/**
*
*/
private String leixing;
/**
*
*/
private String xueke;
/**
*
*/
private String feiyong;
/**
*
*/
private String yonghuzhanghao;
/**
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date goumaishijian;
/**
*
*/
private String sfsh;
/**
*
*/
private String shhf;
/**
*
*/
private String ispay;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date addtime;
public Date getAddtime() {
return addtime;
}
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
*
*/
public void setKechengmingcheng(String kechengmingcheng) {
this.kechengmingcheng = kechengmingcheng;
}
/**
*
*/
public String getKechengmingcheng() {
return kechengmingcheng;
}
/**
*
*/
public void setLeixing(String leixing) {
this.leixing = leixing;
}
/**
*
*/
public String getLeixing() {
return leixing;
}
/**
*
*/
public void setXueke(String xueke) {
this.xueke = xueke;
}
/**
*
*/
public String getXueke() {
return xueke;
}
/**
*
*/
public void setFeiyong(String feiyong) {
this.feiyong = feiyong;
}
/**
*
*/
public String getFeiyong() {
return feiyong;
}
/**
*
*/
public void setYonghuzhanghao(String yonghuzhanghao) {
this.yonghuzhanghao = yonghuzhanghao;
}
/**
*
*/
public String getYonghuzhanghao() {
return yonghuzhanghao;
}
/**
*
*/
public void setGoumaishijian(Date goumaishijian) {
this.goumaishijian = goumaishijian;
}
/**
*
*/
public Date getGoumaishijian() {
return goumaishijian;
}
/**
*
*/
public void setSfsh(String sfsh) {
this.sfsh = sfsh;
}
/**
*
*/
public String getSfsh() {
return sfsh;
}
/**
*
*/
public void setShhf(String shhf) {
this.shhf = shhf;
}
/**
*
*/
public String getShhf() {
return shhf;
}
/**
*
*/
public void setIspay(String ispay) {
this.ispay = ispay;
}
/**
*
*/
public String getIspay() {
return ispay;
}
}
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致性
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的GoumaidekechengEntity对象
public GoumaidekechengEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public GoumaidekechengEntity(T t) {
// 尝试使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// TODO: 可根据实际情况完善异常处理逻辑
// 打印异常堆栈信息
e.printStackTrace();
}
}
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键
private Long id;
// 课程名称
// 定义一个String类型的属性kechengmingcheng用于存储课程的名称
private String kechengmingcheng;
// 类型
// 定义一个String类型的属性leixing用于存储课程的类型
private String leixing;
// 学科
// 定义一个String类型的属性xueke用于存储课程所属的学科
private String xueke;
// 费用
// 定义一个String类型的属性feiyong用于存储购买课程的费用
private String feiyong;
// 用户账号
// 定义一个String类型的属性yonghuzhanghao用于存储购买课程的用户账号
private String yonghuzhanghao;
// 购买时间
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性goumaishijian用于存储课程的购买时间
private Date goumaishijian;
// 是否审核
// 定义一个String类型的属性sfsh用于存储课程购买记录是否经过审核的信息
private String sfsh;
// 审核回复
// 定义一个String类型的属性shhf用于存储课程购买审核的回复内容
private String shhf;
// 是否支付
// 定义一个String类型的属性ispay用于存储课程是否已经支付的信息
private String ispay;
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储记录的添加时间
private Date addtime;
// 获取addtime属性的方法
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法
public Long getId() {
return id;
}
// 设置id属性的方法
public void setId(Long id) {
this.id = id;
}
// 设置:课程名称
// 设置kechengmingcheng属性的方法
public void setKechengmingcheng(String kechengmingcheng) {
this.kechengmingcheng = kechengmingcheng;
}
// 获取:课程名称
// 获取kechengmingcheng属性的方法
public String getKechengmingcheng() {
return kechengmingcheng;
}
// 设置:类型
// 设置leixing属性的方法
public void setLeixing(String leixing) {
this.leixing = leixing;
}
// 获取:类型
// 获取leixing属性的方法
public String getLeixing() {
return leixing;
}
// 设置:学科
// 设置xueke属性的方法
public void setXueke(String xueke) {
this.xueke = xueke;
}
// 获取:学科
// 获取xueke属性的方法
public String getXueke() {
return xueke;
}
// 设置:费用
// 设置feiyong属性的方法
public void setFeiyong(String feiyong) {
this.feiyong = feiyong;
}
// 获取:费用
// 获取feiyong属性的方法
public String getFeiyong() {
return feiyong;
}
// 设置:用户账号
// 设置yonghuzhanghao属性的方法
public void setYonghuzhanghao(String yonghuzhanghao) {
this.yonghuzhanghao = yonghuzhanghao;
}
// 获取:用户账号
// 获取yonghuzhanghao属性的方法
public String getYonghuzhanghao() {
return yonghuzhanghao;
}
// 设置:购买时间
// 设置goumaishijian属性的方法
public void setGoumaishijian(Date goumaishijian) {
this.goumaishijian = goumaishijian;
}
// 获取:购买时间
// 获取goumaishijian属性的方法
public Date getGoumaishijian() {
return goumaishijian;
}
// 设置:是否审核
// 设置sfsh属性的方法
public void setSfsh(String sfsh) {
this.sfsh = sfsh;
}
// 获取:是否审核
// 获取sfsh属性的方法
public String getSfsh() {
return sfsh;
}
// 设置:审核回复
// 设置shhf属性的方法
public void setShhf(String shhf) {
this.shhf = shhf;
}
// 获取:审核回复
// 获取shhf属性的方法
public String getShhf() {
return shhf;
}
// 设置:是否支付
// 设置ispay属性的方法
public void setIspay(String ispay) {
this.ispay = ispay;
}
// 获取:是否支付
// 获取ispay属性的方法
public String getIspay() {
return ispay;
}
}

@ -1,92 +1,113 @@
// 声明该类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空串的注解
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时某些属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类
import java.util.Date;
// 导入Java中用于处理列表集合的接口
import java.util.List;
// 导入Spring框架中用于格式化日期的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:14
*/
// 表示这是课程类型相关的实体类
// 该类用于数据库的通用操作(普通增删改查)
// 原注释中作者信息、邮箱信息和日期信息缺失
// 使用MyBatis-Plus的注解指定该实体类对应数据库中的kechengleixing表
@TableName("kechengleixing")
// 定义一个泛型类KechengleixingEntity实现Serializable接口使对象可序列化
public class KechengleixingEntity<T> implements Serializable {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的KechengleixingEntity对象
public KechengleixingEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public KechengleixingEntity(T t) {
// 尝试使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// 这里只是打印异常堆栈信息,可根据实际情况完善异常处理逻辑
e.printStackTrace();
}
}
/**
* id
*/
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键
private Long id;
/**
*
*/
// 类型
// 定义一个String类型的属性leixing用于存储课程类型
private String leixing;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储记录的添加时间
private Date addtime;
// 获取addtime属性的方法
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法
public Long getId() {
return id;
}
// 设置id属性的方法
public void setId(Long id) {
this.id = id;
}
/**
*
*/
// 设置课程类型的方法
public void setLeixing(String leixing) {
this.leixing = leixing;
}
/**
*
*/
// 获取课程类型的方法
public String getLeixing() {
return leixing;
}
}
}

@ -1,220 +1,234 @@
// 声明该类所在的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空字符串的注解
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时某些属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类
import java.util.Date;
// 导入Java中用于处理列表集合的接口
import java.util.List;
// 导入Spring框架中用于格式化日期的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:14
*/
// 课程信息
// 数据库通用操作实体类(普通增删改查)
// @author
// @email
// @date 2021-05-09 15:46:14
// 使用MyBatis-Plus的注解指定该实体类对应的数据库表名为kechengxinxi
@TableName("kechengxinxi")
// 定义一个泛型类KechengxinxiEntity实现Serializable接口以支持对象的序列化
public class KechengxinxiEntity<T> implements Serializable {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致性
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的KechengxinxiEntity对象
public KechengxinxiEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public KechengxinxiEntity(T t) {
// 尝试使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// TODO: 可根据实际情况完善异常处理逻辑
// 打印异常堆栈信息
e.printStackTrace();
}
}
/**
* id
*/
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键
private Long id;
/**
*
*/
// 课程名称
// 定义一个String类型的属性kechengmingcheng用于存储课程的名称
private String kechengmingcheng;
/**
*
*/
// 类型
// 定义一个String类型的属性leixing用于存储课程的类型
private String leixing;
/**
*
*/
// 学科
// 定义一个String类型的属性xueke用于存储课程所属的学科
private String xueke;
/**
*
*/
// 视频
// 定义一个String类型的属性shipin用于存储课程相关视频的信息
private String shipin;
/**
*
*/
// 老师姓名
// 定义一个String类型的属性laoshixingming用于存储授课老师的姓名
private String laoshixingming;
/**
*
*/
// 费用
// 定义一个String类型的属性feiyong用于存储课程的费用
private String feiyong;
/**
*
*/
// 课程图片
// 定义一个String类型的属性kechengtupian用于存储课程的图片信息
private String kechengtupian;
/**
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
@DateTimeFormat
// 发布时间
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性fabushijian用于存储课程的发布时间
private Date fabushijian;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储记录的添加时间
private Date addtime;
// 获取addtime属性的方法
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法
public Long getId() {
return id;
}
// 设置id属性的方法
public void setId(Long id) {
this.id = id;
}
/**
*
*/
// 设置:课程名称
// 设置kechengmingcheng属性的方法
public void setKechengmingcheng(String kechengmingcheng) {
this.kechengmingcheng = kechengmingcheng;
}
/**
*
*/
// 获取:课程名称
// 获取kechengmingcheng属性的方法
public String getKechengmingcheng() {
return kechengmingcheng;
}
/**
*
*/
// 设置:类型
// 设置leixing属性的方法
public void setLeixing(String leixing) {
this.leixing = leixing;
}
/**
*
*/
// 获取:类型
// 获取leixing属性的方法
public String getLeixing() {
return leixing;
}
/**
*
*/
// 设置:学科
// 设置xueke属性的方法
public void setXueke(String xueke) {
this.xueke = xueke;
}
/**
*
*/
// 获取:学科
// 获取xueke属性的方法
public String getXueke() {
return xueke;
}
/**
*
*/
// 设置:视频
// 设置shipin属性的方法
public void setShipin(String shipin) {
this.shipin = shipin;
}
/**
*
*/
// 获取:视频
// 获取shipin属性的方法
public String getShipin() {
return shipin;
}
/**
*
*/
// 设置:老师姓名
// 设置laoshixingming属性的方法
public void setLaoshixingming(String laoshixingming) {
this.laoshixingming = laoshixingming;
}
/**
*
*/
// 获取:老师姓名
// 获取laoshixingming属性的方法
public String getLaoshixingming() {
return laoshixingming;
}
/**
*
*/
// 设置:费用
// 设置feiyong属性的方法
public void setFeiyong(String feiyong) {
this.feiyong = feiyong;
}
/**
*
*/
// 获取:费用
// 获取feiyong属性的方法
public String getFeiyong() {
return feiyong;
}
/**
*
*/
// 设置:课程图片
// 设置kechengtupian属性的方法
public void setKechengtupian(String kechengtupian) {
this.kechengtupian = kechengtupian;
}
/**
*
*/
// 获取:课程图片
// 获取kechengtupian属性的方法
public String getKechengtupian() {
return kechengtupian;
}
/**
*
*/
// 设置:发布时间
// 设置fabushijian属性的方法
public void setFabushijian(Date fabushijian) {
this.fabushijian = fabushijian;
}
/**
*
*/
// 获取:发布时间
// 获取fabushijian属性的方法
public Date getFabushijian() {
return fabushijian;
}
}
}

@ -1,146 +1,155 @@
// 声明类所在的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架用于标记主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架用于标记表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR 303验证框架中用于验证字符串不为空串的注解
import javax.validation.constraints.NotBlank;
// 导入JSR 303验证框架中用于验证集合、数组等不为空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR 303验证框架中用于验证对象不为null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化和反序列化时某些属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中用于处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中用于实现序列化接口的类
import java.io.Serializable;
// 导入Java中用于处理日期和时间的类
import java.util.Date;
// 导入Java中用于处理列表集合的接口
import java.util.List;
// 导入Spring框架中用于格式化日期的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记表字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中用于定义字段填充策略的枚举类
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中用于定义主键生成类型的枚举类
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 留言板相关实体类
// 该类用于数据库的通用操作(普通增删改查)
// 原注释中作者信息、邮箱信息和日期信息缺失
// 使用MyBatis-Plus的注解指定该实体类对应数据库中的messages表
@TableName("messages")
// 定义一个泛型类MessagesEntity实现Serializable接口使对象可序列化
public class MessagesEntity<T> implements Serializable {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建一个空的MessagesEntity对象
public MessagesEntity() {
}
// 带参构造函数接收一个泛型对象t将其属性复制到当前对象
public MessagesEntity(T t) {
// 尝试使用Apache Commons BeanUtils工具类将对象t的属性复制到当前对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中可能出现的非法访问异常和方法调用异常
// 这里只是打印异常堆栈信息,可根据实际情况完善异常处理逻辑
e.printStackTrace();
}
}
/**
* id
*/
// 主键id
// 使用MyBatis-Plus的注解标记该属性为主键
@TableId
// 定义一个Long类型的属性id用于存储主键
private Long id;
/**
* id
*/
// 留言人id
// 定义一个Long类型的属性userid用于存储留言人的id
private Long userid;
/**
*
*/
// 用户名
// 定义一个String类型的属性username用于存储留言人的用户名
private String username;
/**
*
*/
// 留言内容
// 定义一个String类型的属性content用于存储留言的具体内容
private String content;
/**
*
*/
// 回复内容
// 定义一个String类型的属性reply用于存储对留言的回复内容
private String reply;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson的注解指定日期格式化的模式时区为GMT+8语言为中文
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring的注解指定日期格式化的方式
@DateTimeFormat
// 定义一个Date类型的属性addtime用于存储留言的添加时间
private Date addtime;
// 获取addtime属性的方法
public Date getAddtime() {
return addtime;
}
// 设置addtime属性的方法
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id属性的方法
public Long getId() {
return id;
}
// 设置id属性的方法
public void setId(Long id) {
this.id = id;
}
/**
* id
*/
// 设置留言人id的方法
public void setUserid(Long userid) {
this.userid = userid;
}
/**
* id
*/
// 获取留言人id的方法
public Long getUserid() {
return userid;
}
/**
*
*/
// 设置用户名的方法
public void setUsername(String username) {
this.username = username;
}
/**
*
*/
// 获取用户名的方法
public String getUsername() {
return username;
}
/**
*
*/
// 设置留言内容的方法
public void setContent(String content) {
this.content = content;
}
/**
*
*/
// 获取留言内容的方法
public String getContent() {
return content;
}
/**
*
*/
// 设置回复内容的方法
public void setReply(String reply) {
this.reply = reply;
}
/**
*
*/
// 获取回复内容的方法
public String getReply() {
return reply;
}
}
}

@ -1,146 +1,155 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口
import java.io.Serializable;
// 导入Java中处理日期和时间的类
import java.util.Date;
// 导入Java中处理列表集合的接口虽然当前类未直接使用但保留导入
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解虽然当前类未直接使用但保留导入
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入可能用于扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入可能用于扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 使用MyBatis-Plus注解指定当前类对应数据库表名为news
@TableName("news")
// 定义泛型实体类NewsEntity实现Serializable接口以支持对象序列化
public class NewsEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本序列化兼容性
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建空的实体对象
public NewsEntity() {
// 构造函数体为空
}
// 带参构造函数接收泛型对象t用于属性复制
public NewsEntity(T t) {
// 尝试将泛型对象t的属性复制到当前实体对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息(开发阶段临时处理,生产环境可优化)
e.printStackTrace();
}
}
/**
* id
*/
// 标记为主键字段,对应数据库表的主键列
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值
private Long id;
/**
*
*/
// 定义String类型的title字段用于存储教育资讯的标题
private String title;
/**
*
*/
// 定义String类型的introduction字段用于存储教育资讯的简介
private String introduction;
/**
*
*/
// 定义String类型的picture字段用于存储教育资讯相关图片的路径或链接
private String picture;
/**
*
*/
// 定义String类型的content字段用于存储教育资讯的详细内容
private String content;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式yyyy-MM-dd HH:mm:ss
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持日期格式转换
@DateTimeFormat
// 定义Date类型的addtime字段用于存储记录的添加时间
private Date addtime;
// 获取addtime字段值的方法
public Date getAddtime() {
// 返回添加时间
return addtime;
}
// 设置addtime字段值的方法
public void setAddtime(Date addtime) {
// 将参数值赋给当前对象的addtime字段
this.addtime = addtime;
}
// 获取id字段值的方法主键
public Long getId() {
// 返回主键id
return id;
}
// 设置id字段值的方法主键
public void setId(Long id) {
// 将参数值赋给当前对象的id字段
this.id = id;
}
/**
*
*/
// 设置title字段值的方法资讯标题
public void setTitle(String title) {
// 将参数值赋给当前对象的title字段
this.title = title;
}
/**
*
*/
// 获取title字段值的方法资讯标题
public String getTitle() {
// 返回资讯标题
return title;
}
/**
*
*/
// 设置introduction字段值的方法资讯简介
public void setIntroduction(String introduction) {
// 将参数值赋给当前对象的introduction字段
this.introduction = introduction;
}
/**
*
*/
// 获取introduction字段值的方法资讯简介
public String getIntroduction() {
// 返回资讯简介
return introduction;
}
/**
*
*/
// 设置picture字段值的方法资讯图片
public void setPicture(String picture) {
// 将参数值赋给当前对象的picture字段
this.picture = picture;
}
/**
*
*/
// 获取picture字段值的方法资讯图片
public String getPicture() {
// 返回资讯图片路径或链接
return picture;
}
/**
*
*/
// 设置content字段值的方法资讯内容
public void setContent(String content) {
// 将参数值赋给当前对象的content字段
this.content = content;
}
/**
*
*/
// 获取content字段值的方法资讯内容
public String getContent() {
// 返回资讯详细内容
return content;
}
}
}

@ -1,220 +1,215 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入可能用于扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入可能用于扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入可能用于扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解(当前类未使用,保留导入可能用于扩展)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于日期字段
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入可能用于扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解用于日期字段的格式化
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解用于日期字段的JSON序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数的属性复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入可能用于扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入可能用于扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入可能用于扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:14
*/
// 使用MyBatis-Plus注解指定当前类对应数据库表名为shipindianbo
@TableName("shipindianbo")
// 定义泛型实体类ShipindianboEntity实现Serializable接口以支持对象序列化
public class ShipindianboEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本序列化兼容性
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建空的实体对象
public ShipindianboEntity() {
// 构造函数体为空
}
// 带参构造函数接收泛型对象t用于属性复制
public ShipindianboEntity(T t) {
// 尝试将泛型对象t的属性复制到当前实体对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息(开发阶段临时处理,生产环境可优化)
e.printStackTrace();
}
}
/**
* id
*/
// 标记为主键字段,对应数据库表的主键列
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值
private Long id;
/**
*
*/
// 定义String类型的shipinmingcheng字段用于存储视频名称
private String shipinmingcheng;
/**
*
*/
// 定义String类型的shipin字段用于存储视频文件路径或链接
private String shipin;
/**
*
*/
// 定义String类型的shipinjianjie字段用于存储视频简介
private String shipinjianjie;
/**
*
*/
// 定义String类型的laiyuan字段用于存储视频来源
private String laiyuan;
/**
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式yyyy-MM-dd HH:mm:ss
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持日期格式转换
@DateTimeFormat
// 定义Date类型的shangchuanshijian字段用于存储视频上传时间
private Date shangchuanshijian;
/**
*
*/
// 定义String类型的fengmian字段用于存储视频封面路径或链接
private String fengmian;
/**
*
*/
// 定义String类型的yonghuzhanghao字段用于存储用户账号
private String yonghuzhanghao;
/**
* id
*/
// 定义Long类型的userid字段用于存储用户ID外键关联用户表
private Long userid;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式yyyy-MM-dd HH:mm:ss
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持日期格式转换
@DateTimeFormat
// 定义Date类型的addtime字段用于存储记录的添加时间
private Date addtime;
// 获取addtime字段值的方法记录添加时间
public Date getAddtime() {
// 返回添加时间
return addtime;
}
// 设置addtime字段值的方法记录添加时间
public void setAddtime(Date addtime) {
// 将参数值赋给当前对象的addtime字段
this.addtime = addtime;
}
// 获取id字段值的方法主键
public Long getId() {
// 返回主键id
return id;
}
// 设置id字段值的方法主键
public void setId(Long id) {
// 将参数值赋给当前对象的id字段
this.id = id;
}
/**
*
*/
// 设置shipinmingcheng字段值的方法视频名称
public void setShipinmingcheng(String shipinmingcheng) {
// 将参数值赋给当前对象的shipinmingcheng字段
this.shipinmingcheng = shipinmingcheng;
}
/**
*
*/
// 获取shipinmingcheng字段值的方法视频名称
public String getShipinmingcheng() {
// 返回视频名称
return shipinmingcheng;
}
/**
*
*/
// 设置shipin字段值的方法视频文件路径
public void setShipin(String shipin) {
// 将参数值赋给当前对象的shipin字段
this.shipin = shipin;
}
/**
*
*/
// 获取shipin字段值的方法视频文件路径
public String getShipin() {
// 返回视频文件路径或链接
return shipin;
}
/**
*
*/
// 设置shipinjianjie字段值的方法视频简介
public void setShipinjianjie(String shipinjianjie) {
// 将参数值赋给当前对象的shipinjianjie字段
this.shipinjianjie = shipinjianjie;
}
/**
*
*/
// 获取shipinjianjie字段值的方法视频简介
public String getShipinjianjie() {
// 返回视频简介
return shipinjianjie;
}
/**
*
*/
// 设置laiyuan字段值的方法视频来源
public void setLaiyuan(String laiyuan) {
// 将参数值赋给当前对象的laiyuan字段
this.laiyuan = laiyuan;
}
/**
*
*/
// 获取laiyuan字段值的方法视频来源
public String getLaiyuan() {
// 返回视频来源
return laiyuan;
}
/**
*
*/
// 设置shangchuanshijian字段值的方法视频上传时间
public void setShangchuanshijian(Date shangchuanshijian) {
// 将参数值赋给当前对象的shangchuanshijian字段
this.shangchuanshijian = shangchuanshijian;
}
/**
*
*/
// 获取shangchuanshijian字段值的方法视频上传时间
public Date getShangchuanshijian() {
// 返回视频上传时间
return shangchuanshijian;
}
/**
*
*/
// 设置fengmian字段值的方法视频封面
public void setFengmian(String fengmian) {
// 将参数值赋给当前对象的fengmian字段
this.fengmian = fengmian;
}
/**
*
*/
// 获取fengmian字段值的方法视频封面
public String getFengmian() {
// 返回视频封面路径或链接
return fengmian;
}
/**
*
*/
// 设置yonghuzhanghao字段值的方法用户账号
public void setYonghuzhanghao(String yonghuzhanghao) {
// 将参数值赋给当前对象的yonghuzhanghao字段
this.yonghuzhanghao = yonghuzhanghao;
}
/**
*
*/
// 获取yonghuzhanghao字段值的方法用户账号
public String getYonghuzhanghao() {
// 返回用户账号
return yonghuzhanghao;
}
/**
* id
*/
// 设置userid字段值的方法用户ID
public void setUserid(Long userid) {
// 将参数值赋给当前对象的userid字段
this.userid = userid;
}
/**
* id
*/
// 获取userid字段值的方法用户ID
public Long getUserid() {
// 返回用户ID
return userid;
}
}
}

@ -1,164 +1,169 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解用于标识主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解用于指定实体类对应的表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解(当前类未使用,保留导入以备扩展)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化便于网络传输或持久化
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于日期字段的定义
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解用于前端与后端日期格式的统一转换
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解用于指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为storeup
@TableName("storeup")
// 定义泛型实体类StoreupEntity实现Serializable接口以支持对象的序列化和反序列化
public class StoreupEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性(建议与类结构变更时同步更新)
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建一个空的实体对象(框架反射创建对象时需要)
public StoreupEntity() {
// 构造函数体为空,无需额外操作
}
// 带参构造函数接收一个泛型对象t用于将t的属性复制到当前实体对象
public StoreupEntity(T t) {
// 尝试使用BeanUtils工具类复制对象属性
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息(开发阶段临时处理,生产环境可自定义异常处理逻辑)
e.printStackTrace();
}
}
/**
* id
*/
// 标记该字段为主键对应数据库表中的主键列通常为自增ID
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值
private Long id;
/**
* id
*/
// 定义Long类型的userid字段用于存储用户ID外键关联用户表
private Long userid;
/**
* id
*/
// 定义Long类型的refid字段用于存储收藏对象的ID外键关联被收藏的表记录
private Long refid;
/**
*
*/
// 定义String类型的tablename字段用于存储被收藏对象对应的表名如"kechengxinxi"
private String tablename;
/**
*
*/
// 定义String类型的name字段用于存储收藏项的名称如课程名称、资讯标题等
private String name;
/**
*
*/
// 定义String类型的picture字段用于存储收藏项的封面图片路径或链接
private String picture;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式年-月-日 时:分:秒)
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换
@DateTimeFormat
// 定义Date类型的addtime字段用于存储收藏记录的添加时间
private Date addtime;
// 获取addtime字段值的方法返回收藏记录的添加时间
public Date getAddtime() {
// 返回添加时间属性值
return addtime;
}
// 设置addtime字段值的方法设置收藏记录的添加时间
public void setAddtime(Date addtime) {
// 将参数值赋给当前对象的addtime属性
this.addtime = addtime;
}
// 获取id字段值的方法返回主键ID
public Long getId() {
// 返回主键ID属性值
return id;
}
// 设置id字段值的方法设置主键ID通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
// 将参数值赋给当前对象的id属性
this.id = id;
}
/**
* id
*/
// 设置userid字段值的方法设置用户ID
public void setUserid(Long userid) {
// 将参数值赋给当前对象的userid属性
this.userid = userid;
}
/**
* id
*/
// 获取userid字段值的方法返回用户ID
public Long getUserid() {
// 返回用户ID属性值
return userid;
}
/**
* id
*/
// 设置refid字段值的方法设置收藏对象的ID
public void setRefid(Long refid) {
// 将参数值赋给当前对象的refid属性
this.refid = refid;
}
/**
* id
*/
// 获取refid字段值的方法返回收藏对象的ID
public Long getRefid() {
// 返回收藏对象ID属性值
return refid;
}
/**
*
*/
// 设置tablename字段值的方法设置被收藏对象对应的表名
public void setTablename(String tablename) {
// 将参数值赋给当前对象的tablename属性
this.tablename = tablename;
}
/**
*
*/
// 获取tablename字段值的方法返回被收藏对象对应的表名
public String getTablename() {
// 返回表名属性值
return tablename;
}
/**
*
*/
// 设置name字段值的方法设置收藏项的名称
public void setName(String name) {
// 将参数值赋给当前对象的name属性
this.name = name;
}
/**
*
*/
// 获取name字段值的方法返回收藏项的名称
public String getName() {
// 返回收藏名称属性值
return name;
}
/**
*
*/
// 设置picture字段值的方法设置收藏项的封面图片
public void setPicture(String picture) {
// 将参数值赋给当前对象的picture属性
this.picture = picture;
}
/**
*
*/
// 获取picture字段值的方法返回收藏项的封面图片路径或链接
public String getPicture() {
// 返回图片路径属性值
return picture;
}
}
}

@ -1,123 +1,161 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入Java序列化接口使实体类支持对象序列化用于网络传输或持久化存储
import java.io.Serializable;
// 导入Java日期类用于处理日期和时间字段
import java.util.Date;
// 导入MyBatis-Plus的主键注解用于标记数据库表的主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus的表名注解用于指定实体类对应的数据库表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入MyBatis-Plus的主键生成类型枚举用于配置主键生成策略
import com.baomidou.mybatisplus.enums.IdType;
/**
* token
*/
// token表实体类
// 用于存储用户令牌信息,实现用户身份验证和权限管理
// 使用MyBatis-Plus注解指定对应的数据库表名为"token"
@TableName("token")
// 定义TokenEntity类实现Serializable接口以支持对象的序列化和反序列化
public class TokenEntity implements Serializable {
// 定义序列化版本号,确保不同版本的兼容性(建议与类结构同步更新)
private static final long serialVersionUID = 1L;
// 标记为主键字段指定主键生成策略为数据库自增AUTO
@TableId(type = IdType.AUTO)
// 主键ID由数据库自增生成唯一标识一条token记录
private Long id;
/**
* id
*/
// 用户ID关联用户表的主键标识该token所属的用户
private Long userid;
/**
*
*/
// 用户名,令牌所属用户的登录名称,用于快速识别用户身份
private String username;
/**
*
*/
// 表名标识该token关联的数据库表如用户表、管理员表等用于区分不同类型的用户
private String tablename;
/**
*
*/
// 角色,用户的角色信息(如"user"、"admin"),用于权限控制和功能访问限制
private String role;
/**
* token
*/
// 令牌值用于验证用户身份的唯一凭证客户端通过该token访问受保护的资源
private String token;
/**
*
*/
// 过期时间,令牌的有效截止时间,超过该时间后令牌失效,需重新获取
private Date expiratedtime;
/**
*
*/
// 新增时间记录token创建的具体时间用于审计和日志追踪
private Date addtime;
// ------------------------- Getter 方法 -------------------------
// 获取主键ID
// @return 主键ID数据库自增生成的唯一标识
public Long getId() {
return id;
}
// 设置主键ID通常由数据库自动生成代码中一般不手动设置
// @param id 主键ID值
public void setId(Long id) {
this.id = id;
}
// 获取用户ID
// @return 用户ID关联用户表的主键标识token所属用户
public Long getUserid() {
return userid;
}
// 设置用户ID
// @param userid 用户ID值
public void setUserid(Long userid) {
this.userid = userid;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
// 获取用户名
// @return 用户名token所属用户的登录名称
public String getUsername() {
return username;
}
public String getToken() {
return token;
// 设置用户名
// @param username 用户名值
public void setUsername(String username) {
this.username = username;
}
// 获取关联的表名
// @return 表名标识token关联的数据库表
public String getTablename() {
return tablename;
}
// 设置关联的表名
// @param tablename 表名值(如"user"、"admin"对应的表)
public void setTablename(String tablename) {
this.tablename = tablename;
}
// 获取用户角色
// @return 角色,用户的权限角色(如普通用户、管理员)
public String getRole() {
return role;
}
// 设置用户角色
// @param role 角色值(用于权限控制)
public void setRole(String role) {
this.role = role;
}
// 获取令牌值
// @return 令牌,用户身份验证的唯一凭证
public String getToken() {
return token;
}
// 设置令牌值
// @param token 令牌值(通常由认证服务生成)
public void setToken(String token) {
this.token = token;
}
// 获取过期时间
// @return 过期时间,令牌失效的时间点
public Date getExpiratedtime() {
return expiratedtime;
}
// 设置过期时间
// @param expiratedtime 过期时间值需为Date类型
public void setExpiratedtime(Date expiratedtime) {
this.expiratedtime = expiratedtime;
}
// 获取新增时间
// @return 新增时间token记录的创建时间
public Date getAddtime() {
return addtime;
}
// 设置新增时间(通常由系统自动生成,无需手动设置)
// @param addtime 新增时间值
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
// ------------------------- 构造方法 -------------------------
public TokenEntity(Long userid, String username, String tablename,String role, String token, Date expiratedtime) {
super();
// 带参数的构造方法用于初始化token记录的主要信息
// @param userid 用户ID标识token所属用户
// @param username 用户名,用户的登录名称
// @param tablename 关联表名,标识用户类型对应的表
// @param role 用户角色,用于权限控制
// @param token 令牌值,身份验证凭证
// @param expiratedtime 过期时间,令牌有效截止时间
public TokenEntity(Long userid, String username, String tablename, String role, String token, Date expiratedtime) {
this.userid = userid;
this.username = username;
this.tablename = tablename;
@ -125,8 +163,8 @@ public class TokenEntity implements Serializable {
this.token = token;
this.expiratedtime = expiratedtime;
}
// 无参构造方法用于框架反射创建对象如MyBatis-Plus自动实例化
public TokenEntity() {
}
}
}

@ -1,77 +1,100 @@
// 声明该类属于com.entity包
package com.entity;
// 导入Java的序列化接口使类可实现序列化用于对象的存储和传输
import java.io.Serializable;
// 导入Java的日期类用于处理日期和时间
import java.util.Date;
// 导入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的注解指定该实体类对应数据库中的users表
@TableName("users")
// 定义UserEntity类实现Serializable接口使该类的对象可以被序列化
public class UserEntity implements Serializable {
// 定义序列化版本号,确保序列化和反序列化过程中类的版本一致
private static final long serialVersionUID = 1L;
// 使用MyBatis-Plus的注解标记该属性为主键且主键生成策略为数据库自增
@TableId(type = IdType.AUTO)
// 定义一个Long类型的属性id用于存储数据库表的主键
private Long id;
/**
*
*/
// 定义一个String类型的属性username用于存储用户账号
private String username;
/**
*
*/
// 定义一个String类型的属性password用于存储用户密码
private String password;
/**
*
*/
// 定义一个String类型的属性role用于存储用户类型
private String role;
// 定义一个Date类型的属性addtime用于存储用户记录的添加时间
private Date addtime;
// 获取用户账号的方法
public String getUsername() {
// 返回用户账号
return username;
}
// 设置用户账号的方法
public void setUsername(String username) {
// 将参数值赋给当前对象的username属性
this.username = username;
}
// 获取用户密码的方法
public String getPassword() {
// 返回用户密码
return password;
}
// 设置用户密码的方法
public void setPassword(String password) {
// 将参数值赋给当前对象的password属性
this.password = password;
}
// 获取用户类型的方法
public String getRole() {
// 返回用户类型
return role;
}
// 设置用户类型的方法
public void setRole(String role) {
// 将参数值赋给当前对象的role属性
this.role = role;
}
// 获取记录添加时间的方法
public Date getAddtime() {
// 返回记录添加时间
return addtime;
}
// 设置记录添加时间的方法
public void setAddtime(Date addtime) {
// 将参数值赋给当前对象的addtime属性
this.addtime = addtime;
}
// 获取主键id的方法
public Long getId() {
// 返回主键id
return id;
}
// 设置主键id的方法
public void setId(Long id) {
// 将参数值赋给当前对象的id属性
this.id = id;
}
}
}

@ -1,128 +1,141 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解用于标识主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解用于指定实体类对应的表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解(当前类未使用,保留导入以备扩展)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化便于网络传输或持久化
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于日期字段的定义
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解用于前端与后端日期格式的统一转换
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解用于指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为wodebiji
@TableName("wodebiji")
// 定义泛型实体类WodebijiEntity实现Serializable接口以支持对象的序列化和反序列化
public class WodebijiEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性(建议与类结构变更时同步更新)
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建一个空的实体对象(框架反射创建对象时需要)
public WodebijiEntity() {
// 构造函数体为空
}
// 带参构造函数接收一个泛型对象t用于将t的属性复制到当前实体对象
public WodebijiEntity(T t) {
// 尝试使用BeanUtils工具类复制对象属性
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息(开发阶段临时处理,生产环境可自定义异常处理逻辑)
e.printStackTrace();
}
}
/**
* id
*/
// 标记该字段为主键,对应数据库表中的主键列(默认主键生成策略)
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值
private Long id;
/**
*
*/
// 定义String类型的biaoti字段用于存储笔记的标题
private String biaoti;
/**
*
*/
// 定义String类型的neirong字段用于存储笔记的内容
private String neirong;
/**
*
*/
// 定义String类型的yonghuzhanghao字段用于存储用户账号关联用户信息
private String yonghuzhanghao;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式年-月-日 时:分:秒)
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换
@DateTimeFormat
// 定义Date类型的addtime字段用于存储笔记记录的添加时间
private Date addtime;
// 获取addtime字段值的方法返回笔记记录的添加时间
public Date getAddtime() {
// 返回添加时间属性值
return addtime;
}
// 设置addtime字段值的方法设置笔记记录的添加时间
public void setAddtime(Date addtime) {
// 将参数值赋给当前对象的addtime属性
this.addtime = addtime;
}
// 获取id字段值的方法返回主键ID
public Long getId() {
// 返回主键ID属性值
return id;
}
// 设置id字段值的方法设置主键ID通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
// 将参数值赋给当前对象的id属性
this.id = id;
}
/**
*
*/
// 设置biaoti字段值的方法设置笔记标题
public void setBiaoti(String biaoti) {
// 将参数值赋给当前对象的biaoti属性
this.biaoti = biaoti;
}
/**
*
*/
// 获取biaoti字段值的方法返回笔记标题
public String getBiaoti() {
// 返回笔记标题属性值
return biaoti;
}
/**
*
*/
// 设置neirong字段值的方法设置笔记内容
public void setNeirong(String neirong) {
// 将参数值赋给当前对象的neirong属性
this.neirong = neirong;
}
/**
*
*/
// 获取neirong字段值的方法返回笔记内容
public String getNeirong() {
// 返回笔记内容属性值
return neirong;
}
/**
*
*/
// 设置yonghuzhanghao字段值的方法设置用户账号
public void setYonghuzhanghao(String yonghuzhanghao) {
// 将参数值赋给当前对象的yonghuzhanghao属性
this.yonghuzhanghao = yonghuzhanghao;
}
/**
*
*/
// 获取yonghuzhanghao字段值的方法返回用户账号
public String getYonghuzhanghao() {
// 返回用户账号属性值
return yonghuzhanghao;
}
}
}

@ -1,146 +1,155 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解用于标识主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解用于指定实体类对应的表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解(当前类未使用,保留导入以备扩展)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化便于网络传输或持久化
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于日期字段的定义
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解用于前端与后端日期格式的统一转换
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解用于指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为wodekecheng
@TableName("wodekecheng")
// 定义泛型实体类WodekechengEntity实现Serializable接口以支持对象的序列化和反序列化
public class WodekechengEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性(建议与类结构变更时同步更新)
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建一个空的实体对象(框架反射创建对象时需要)
public WodekechengEntity() {
// 构造函数体为空
}
// 带参构造函数接收一个泛型对象t用于将t的属性复制到当前实体对象
public WodekechengEntity(T t) {
// 尝试使用BeanUtils工具类复制对象属性
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息(开发阶段临时处理,生产环境可自定义异常处理逻辑)
e.printStackTrace();
}
}
/**
* id
*/
// 标记该字段为主键,对应数据库表中的主键列(默认主键生成策略)
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值
private Long id;
/**
*
*/
// 定义String类型的kechengmingcheng字段用于存储课程名称
private String kechengmingcheng;
/**
*
*/
// 定义String类型的zhangjie字段用于存储课程的章节信息
private String zhangjie;
/**
*
*/
// 定义String类型的wenjian字段用于存储课程相关的文件路径或名称
private String wenjian;
/**
*
*/
// 定义String类型的yonghuzhanghao字段用于存储用户账号关联用户信息
private String yonghuzhanghao;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式年-月-日 时:分:秒)
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换
@DateTimeFormat
// 定义Date类型的addtime字段用于存储课程记录的添加时间
private Date addtime;
// 获取addtime字段值的方法返回课程记录的添加时间
public Date getAddtime() {
// 返回添加时间属性值
return addtime;
}
// 设置addtime字段值的方法设置课程记录的添加时间
public void setAddtime(Date addtime) {
// 将参数值赋给当前对象的addtime属性
this.addtime = addtime;
}
// 获取id字段值的方法返回主键ID
public Long getId() {
// 返回主键ID属性值
return id;
}
// 设置id字段值的方法设置主键ID通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
// 将参数值赋给当前对象的id属性
this.id = id;
}
/**
*
*/
// 设置kechengmingcheng字段值的方法设置课程名称
public void setKechengmingcheng(String kechengmingcheng) {
// 将参数值赋给当前对象的kechengmingcheng属性
this.kechengmingcheng = kechengmingcheng;
}
/**
*
*/
// 获取kechengmingcheng字段值的方法返回课程名称
public String getKechengmingcheng() {
// 返回课程名称属性值
return kechengmingcheng;
}
/**
*
*/
// 设置zhangjie字段值的方法设置课程章节
public void setZhangjie(String zhangjie) {
// 将参数值赋给当前对象的zhangjie属性
this.zhangjie = zhangjie;
}
/**
*
*/
// 获取zhangjie字段值的方法返回课程章节
public String getZhangjie() {
// 返回课程章节属性值
return zhangjie;
}
/**
*
*/
// 设置wenjian字段值的方法设置课程文件
public void setWenjian(String wenjian) {
// 将参数值赋给当前对象的wenjian属性
this.wenjian = wenjian;
}
/**
*
*/
// 获取wenjian字段值的方法返回课程文件路径或名称
public String getWenjian() {
// 返回课程文件属性值
return wenjian;
}
/**
*
*/
// 设置yonghuzhanghao字段值的方法设置用户账号
public void setYonghuzhanghao(String yonghuzhanghao) {
// 将参数值赋给当前对象的yonghuzhanghao属性
this.yonghuzhanghao = yonghuzhanghao;
}
/**
*
*/
// 获取yonghuzhanghao字段值的方法返回用户账号
public String getYonghuzhanghao() {
// 返回用户账号属性值
return yonghuzhanghao;
}
}
}

@ -1,148 +1,160 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解用于标识主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解用于指定实体类对应的表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解(当前类未使用,保留导入以备扩展)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化便于网络传输或持久化
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于日期字段的定义
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解用于前端与后端日期格式的统一转换
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解用于指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:15
*/
// 消息通知实体类
// 数据库通用操作实体类(普通增删改查)
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为xiaoxitongzhi
@TableName("xiaoxitongzhi")
// 定义泛型实体类XiaoxitongzhiEntity实现Serializable接口以支持对象的序列化和反序列化
public class XiaoxitongzhiEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性(建议与类结构变更时同步更新)
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建一个空的实体对象(框架反射创建对象时需要)
public XiaoxitongzhiEntity() {
// 构造函数体为空
}
// 带参构造函数接收一个泛型对象t用于将t的属性复制到当前实体对象
public XiaoxitongzhiEntity(T t) {
// 尝试使用BeanUtils工具类复制对象属性
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息(开发阶段临时处理,生产环境可自定义异常处理逻辑)
e.printStackTrace();
}
}
/**
* id
*/
// 标记该字段为主键,对应数据库表中的主键列(默认主键生成策略)
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值
private Long id;
/**
*
*/
// 定义String类型的tongzhibiaoti字段用于存储通知的标题
private String tongzhibiaoti;
/**
*
*/
// 定义String类型的tongzhineirong字段用于存储通知的具体内容
private String tongzhineirong;
/**
*
*/
// 定义String类型的yonghuzhanghao字段用于存储接收通知的用户账号关联用户信息
private String yonghuzhanghao;
/**
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式年-月-日 时:分:秒)
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换
@DateTimeFormat
// 定义Date类型的fasongshijian字段用于存储通知的发送时间
private Date fasongshijian;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式年-月-日 时:分:秒)
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换
@DateTimeFormat
// 定义Date类型的addtime字段用于存储通知记录的添加时间
private Date addtime;
// 获取addtime字段值的方法返回通知记录的添加时间
public Date getAddtime() {
// 返回添加时间属性值
return addtime;
}
// 设置addtime字段值的方法设置通知记录的添加时间
public void setAddtime(Date addtime) {
// 将参数值赋给当前对象的addtime属性
this.addtime = addtime;
}
// 获取id字段值的方法返回主键ID
public Long getId() {
// 返回主键ID属性值
return id;
}
// 设置id字段值的方法设置主键ID通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
// 将参数值赋给当前对象的id属性
this.id = id;
}
/**
*
*/
// 设置tongzhibiaoti字段值的方法设置通知标题
public void setTongzhibiaoti(String tongzhibiaoti) {
// 将参数值赋给当前对象的tongzhibiaoti属性
this.tongzhibiaoti = tongzhibiaoti;
}
/**
*
*/
// 获取tongzhibiaoti字段值的方法返回通知标题
public String getTongzhibiaoti() {
// 返回通知标题属性值
return tongzhibiaoti;
}
/**
*
*/
// 设置tongzhineirong字段值的方法设置通知内容
public void setTongzhineirong(String tongzhineirong) {
// 将参数值赋给当前对象的tongzhineirong属性
this.tongzhineirong = tongzhineirong;
}
/**
*
*/
// 获取tongzhineirong字段值的方法返回通知内容
public String getTongzhineirong() {
// 返回通知内容属性值
return tongzhineirong;
}
/**
*
*/
// 设置yonghuzhanghao字段值的方法设置用户账号
public void setYonghuzhanghao(String yonghuzhanghao) {
// 将参数值赋给当前对象的yonghuzhanghao属性
this.yonghuzhanghao = yonghuzhanghao;
}
/**
*
*/
// 获取yonghuzhanghao字段值的方法返回用户账号
public String getYonghuzhanghao() {
// 返回用户账号属性值
return yonghuzhanghao;
}
/**
*
*/
// 设置fasongshijian字段值的方法设置通知发送时间
public void setFasongshijian(Date fasongshijian) {
// 将参数值赋给当前对象的fasongshijian属性
this.fasongshijian = fasongshijian;
}
/**
*
*/
// 获取fasongshijian字段值的方法返回通知发送时间
public Date getFasongshijian() {
// 返回通知发送时间属性值
return fasongshijian;
}
}
}

@ -1,92 +1,115 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解用于标识主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解用于指定实体类对应的表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解(当前类未使用,保留导入以备扩展)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化便于网络传输或持久化
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于日期字段的定义
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解用于前端与后端日期格式的统一转换
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解用于指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:14
*/
// 学科实体类
// 数据库通用操作实体类(普通增删改查)
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为xueke
@TableName("xueke")
// 定义泛型实体类XuekeEntity实现Serializable接口以支持对象的序列化和反序列化
public class XuekeEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性(建议与类结构变更时同步更新)
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建一个空的实体对象(框架反射创建对象时需要)
public XuekeEntity() {
// 构造函数体为空
}
// 带参构造函数接收一个泛型对象t用于将t的属性复制到当前实体对象
public XuekeEntity(T t) {
// 尝试使用BeanUtils工具类复制对象属性
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息(开发阶段临时处理,生产环境可自定义异常处理逻辑)
e.printStackTrace();
}
}
/**
* id
*/
// 标记该字段为主键,对应数据库表中的主键列(默认主键生成策略)
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值
private Long id;
/**
*
*/
// 定义String类型的xueke字段用于存储学科名称
private String xueke;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区GMT+8格式年-月-日 时:分:秒)
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换
@DateTimeFormat
// 定义Date类型的addtime字段用于存储学科记录的添加时间
private Date addtime;
// 获取addtime字段值的方法返回学科记录的添加时间
public Date getAddtime() {
// 返回添加时间属性值
return addtime;
}
// 设置addtime字段值的方法设置学科记录的添加时间
public void setAddtime(Date addtime) {
// 将参数值赋给当前对象的addtime属性
this.addtime = addtime;
}
// 获取id字段值的方法返回主键ID
public Long getId() {
// 返回主键ID属性值
return id;
}
// 设置id字段值的方法设置主键ID通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
// 将参数值赋给当前对象的id属性
this.id = id;
}
/**
*
*/
// 设置xueke字段值的方法设置学科名称
public void setXueke(String xueke) {
// 将参数值赋给当前对象的xueke属性
this.xueke = xueke;
}
/**
*
*/
// 获取xueke字段值的方法返回学科名称
public String getXueke() {
// 返回学科名称属性值
return xueke;
}
}
}

@ -1,200 +1,178 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解用于标识实体类中的主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解用于指定实体类对应的数据库表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解,当前类未使用,保留导入以备扩展
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数中属性复制时的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化便于网络传输或持久化存储
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于定义日期类型的字段
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解用于前端与后端日期参数的格式统一
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解用于指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:14
*/
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为"yonghu"
@TableName("yonghu")
// 定义泛型实体类YonghuEntity实现Serializable接口以支持对象的序列化和反序列化
public class YonghuEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性,建议与类结构变更时同步更新
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建一个空的实体对象,满足框架反射创建对象的需求
public YonghuEntity() {
}
// 带参构造函数接收一个泛型对象t用于将t的属性复制到当前实体对象
public YonghuEntity(T t) {
// 尝试使用BeanUtils工具类将泛型对象t的属性复制到当前实体对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息,开发阶段临时处理,生产环境可自定义异常处理逻辑
e.printStackTrace();
}
}
/**
* id
*/
// 标记该字段为主键对应数据库表中的主键列使用MyBatis-Plus默认的主键生成策略
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值唯一标识一条用户记录
private Long id;
/**
*
*/
// 定义String类型的yonghuzhanghao字段用于存储用户账号对应数据库中的用户账号列
private String yonghuzhanghao;
/**
*
*/
// 定义String类型的mima字段用于存储用户密码对应数据库中的密码列
private String mima;
/**
*
*/
// 定义String类型的yonghuxingming字段用于存储用户姓名对应数据库中的用户姓名字段
private String yonghuxingming;
/**
*
*/
// 定义String类型的xingbie字段用于存储用户性别对应数据库中的性别列
private String xingbie;
/**
*
*/
// 定义String类型的shouji字段用于存储用户手机号码对应数据库中的手机列
private String shouji;
/**
*
*/
// 定义String类型的youxiang字段用于存储用户邮箱对应数据库中的邮箱列
private String youxiang;
/**
*
*/
// 定义String类型的touxiang字段用于存储用户头像的路径或链接对应数据库中的头像列
private String touxiang;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区为GMT+8格式为"yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换确保日期格式统一
@DateTimeFormat
// 定义Date类型的addtime字段用于存储用户记录的添加时间对应数据库中的添加时间列
private Date addtime;
// 获取addtime字段值的方法返回用户记录的添加时间
public Date getAddtime() {
return addtime;
}
// 设置addtime字段值的方法用于设置用户记录的添加时间
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id字段值的方法返回数据库表的主键ID
public Long getId() {
return id;
}
// 设置id字段值的方法用于设置主键ID通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
this.id = id;
}
/**
*
*/
// 设置yonghuzhanghao字段值的方法用于设置用户账号
public void setYonghuzhanghao(String yonghuzhanghao) {
this.yonghuzhanghao = yonghuzhanghao;
}
/**
*
*/
// 获取yonghuzhanghao字段值的方法返回用户账号
public String getYonghuzhanghao() {
return yonghuzhanghao;
}
/**
*
*/
// 设置mima字段值的方法用于设置用户密码
public void setMima(String mima) {
this.mima = mima;
}
/**
*
*/
// 获取mima字段值的方法返回用户密码
public String getMima() {
return mima;
}
/**
*
*/
// 设置yonghuxingming字段值的方法用于设置用户姓名
public void setYonghuxingming(String yonghuxingming) {
this.yonghuxingming = yonghuxingming;
}
/**
*
*/
// 获取yonghuxingming字段值的方法返回用户姓名
public String getYonghuxingming() {
return yonghuxingming;
}
/**
*
*/
// 设置xingbie字段值的方法用于设置用户性别
public void setXingbie(String xingbie) {
this.xingbie = xingbie;
}
/**
*
*/
// 获取xingbie字段值的方法返回用户性别
public String getXingbie() {
return xingbie;
}
/**
*
*/
// 设置shouji字段值的方法用于设置用户手机号码
public void setShouji(String shouji) {
this.shouji = shouji;
}
/**
*
*/
// 获取shouji字段值的方法返回用户手机号码
public String getShouji() {
return shouji;
}
/**
*
*/
// 设置youxiang字段值的方法用于设置用户邮箱
public void setYouxiang(String youxiang) {
this.youxiang = youxiang;
}
/**
*
*/
// 获取youxiang字段值的方法返回用户邮箱
public String getYouxiang() {
return youxiang;
}
/**
*
*/
// 设置touxiang字段值的方法用于设置用户头像路径或链接
public void setTouxiang(String touxiang) {
this.touxiang = touxiang;
}
/**
*
*/
// 获取touxiang字段值的方法返回用户头像路径或链接
public String getTouxiang() {
return touxiang;
}
}
}

@ -1,272 +1,226 @@
// 声明当前类所属的包为com.entity
package com.entity;
// 导入MyBatis-Plus框架中用于标记数据库表主键的注解用于标识实体类中的主键字段
import com.baomidou.mybatisplus.annotations.TableId;
// 导入MyBatis-Plus框架中用于标记数据库表名的注解用于指定实体类对应的数据库表名
import com.baomidou.mybatisplus.annotations.TableName;
// 导入JSR-303验证框架中用于验证字符串非空排除空格后的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotBlank;
// 导入JSR-303验证框架中用于验证集合、数组等非空的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotEmpty;
// 导入JSR-303验证框架中用于验证对象非null的注解当前类未使用保留导入以备扩展
import javax.validation.constraints.NotNull;
// 导入Jackson库中用于忽略JSON序列化/反序列化时特定属性的注解,当前类未使用,保留导入以备扩展
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入Java反射机制中处理方法调用异常的类用于构造函数中属性复制时的异常处理
import java.lang.reflect.InvocationTargetException;
// 导入Java中实现对象序列化的接口使当前类支持对象序列化便于网络传输或持久化存储
import java.io.Serializable;
// 导入Java中处理日期和时间的类用于定义日期类型的字段
import java.util.Date;
// 导入Java中处理列表集合的接口当前类未直接使用保留导入以备扩展
import java.util.List;
// 导入Spring框架中用于处理日期格式转换的注解用于前端与后端日期参数的格式统一
import org.springframework.format.annotation.DateTimeFormat;
// 导入Jackson库中用于格式化JSON日期输出的注解用于指定日期在JSON中的序列化格式
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入Apache Commons BeanUtils库中用于Bean属性复制的工具类用于构造函数中对象属性的复制
import org.apache.commons.beanutils.BeanUtils;
// 导入MyBatis-Plus框架中用于标记数据库表字段的注解当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.annotations.TableField;
// 导入MyBatis-Plus框架中定义字段填充策略的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入MyBatis-Plus框架中定义主键生成类型的枚举类当前类未使用保留导入以备扩展
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @date 2021-05-09 15:46:14
*/
// 使用MyBatis-Plus注解指定当前类对应的数据库表名为"zhiyeguihua"
@TableName("zhiyeguihua")
// 定义泛型实体类ZhiyeguihuaEntity实现Serializable接口以支持对象的序列化和反序列化
public class ZhiyeguihuaEntity<T> implements Serializable {
// 定义序列化版本号,确保不同版本的序列化兼容性,建议与类结构变更时同步更新
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建一个空的实体对象,满足框架反射创建对象的需求
public ZhiyeguihuaEntity() {
}
// 带参构造函数接收一个泛型对象t用于将t的属性复制到当前实体对象
public ZhiyeguihuaEntity(T t) {
// 尝试使用BeanUtils工具类将泛型对象t的属性复制到当前实体对象
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 捕获属性复制过程中的非法访问异常或方法调用异常
// 打印异常堆栈信息,开发阶段临时处理,生产环境可自定义异常处理逻辑
e.printStackTrace();
}
}
/**
* id
*/
// 标记该字段为主键对应数据库表中的主键列使用MyBatis-Plus默认的主键生成策略
@TableId
// 定义Long类型的id字段用于存储数据库表的主键值唯一标识一条职业规划记录
private Long id;
/**
*
*/
// 定义String类型的ziwofenxi字段用于存储职业规划中的自我分析内容
private String ziwofenxi;
/**
*
*/
// 定义String类型的quelimubiao字段用于存储职业规划中确立的目标
private String quelimubiao;
/**
*
*/
// 定义String类型的huanjingpingjia字段用于存储职业规划中的环境评价内容
private String huanjingpingjia;
/**
*
*/
// 定义String类型的zhiyedingwei字段用于存储职业规划中的职业定位信息
private String zhiyedingwei;
/**
*
*/
// 定义String类型的shishicelve字段用于存储职业规划中的实施策略
private String shishicelve;
/**
*
*/
// 定义String类型的pingguyufankui字段用于存储职业规划中的评估与反馈内容
private String pingguyufankui;
/**
*
*/
// 定义String类型的fengmian字段用于存储职业规划文档的封面路径或链接
private String fengmian;
/**
*
*/
// 定义String类型的xingming字段用于存储用户姓名
private String xingming;
/**
*
*/
// 定义String类型的xingbie字段用于存储用户性别
private String xingbie;
/**
*
*/
// 定义String类型的nianling字段用于存储用户年龄
private String nianling;
/**
*
*/
// 定义String类型的muqianzhiye字段用于存储用户目前的职业
private String muqianzhiye;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 使用Jackson注解指定日期在JSON中的格式时区为GMT+8格式为"yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 使用Spring注解支持前端日期参数的自动格式化转换确保日期格式统一
@DateTimeFormat
// 定义Date类型的addtime字段用于存储职业规划记录的添加时间对应数据库中的添加时间列
private Date addtime;
// 获取addtime字段值的方法返回职业规划记录的添加时间
public Date getAddtime() {
return addtime;
}
// 设置addtime字段值的方法用于设置职业规划记录的添加时间
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
// 获取id字段值的方法返回数据库表的主键ID
public Long getId() {
return id;
}
// 设置id字段值的方法用于设置主键ID通常由数据库自动生成代码中较少手动设置
public void setId(Long id) {
this.id = id;
}
/**
*
*/
// 设置ziwofenxi字段值的方法用于设置职业规划中的自我分析内容
public void setZiwofenxi(String ziwofenxi) {
this.ziwofenxi = ziwofenxi;
}
/**
*
*/
// 获取ziwofenxi字段值的方法返回职业规划中的自我分析内容
public String getZiwofenxi() {
return ziwofenxi;
}
/**
*
*/
// 设置quelimubiao字段值的方法用于设置职业规划中确立的目标
public void setQuelimubiao(String quelimubiao) {
this.quelimubiao = quelimubiao;
}
/**
*
*/
// 获取quelimubiao字段值的方法返回职业规划中确立的目标
public String getQuelimubiao() {
return quelimubiao;
}
/**
*
*/
// 设置huanjingpingjia字段值的方法用于设置职业规划中的环境评价内容
public void setHuanjingpingjia(String huanjingpingjia) {
this.huanjingpingjia = huanjingpingjia;
}
/**
*
*/
// 获取huanjingpingjia字段值的方法返回职业规划中的环境评价内容
public String getHuanjingpingjia() {
return huanjingpingjia;
}
/**
*
*/
// 设置zhiyedingwei字段值的方法用于设置职业规划中的职业定位信息
public void setZhiyedingwei(String zhiyedingwei) {
this.zhiyedingwei = zhiyedingwei;
}
/**
*
*/
// 获取zhiyedingwei字段值的方法返回职业规划中的职业定位信息
public String getZhiyedingwei() {
return zhiyedingwei;
}
/**
*
*/
// 设置shishicelve字段值的方法用于设置职业规划中的实施策略
public void setShishicelve(String shishicelve) {
this.shishicelve = shishicelve;
}
/**
*
*/
// 获取shishicelve字段值的方法返回职业规划中的实施策略
public String getShishicelve() {
return shishicelve;
}
/**
*
*/
// 设置pingguyufankui字段值的方法用于设置职业规划中的评估与反馈内容
public void setPingguyufankui(String pingguyufankui) {
this.pingguyufankui = pingguyufankui;
}
/**
*
*/
// 获取pingguyufankui字段值的方法返回职业规划中的评估与反馈内容
public String getPingguyufankui() {
return pingguyufankui;
}
/**
*
*/
// 设置fengmian字段值的方法用于设置职业规划文档的封面
public void setFengmian(String fengmian) {
this.fengmian = fengmian;
}
/**
*
*/
// 获取fengmian字段值的方法返回职业规划文档的封面路径或链接
public String getFengmian() {
return fengmian;
}
/**
*
*/
// 设置xingming字段值的方法用于设置用户姓名
public void setXingming(String xingming) {
this.xingming = xingming;
}
/**
*
*/
// 获取xingming字段值的方法返回用户姓名
public String getXingming() {
return xingming;
}
/**
*
*/
// 设置xingbie字段值的方法用于设置用户性别
public void setXingbie(String xingbie) {
this.xingbie = xingbie;
}
/**
*
*/
// 获取xingbie字段值的方法返回用户性别
public String getXingbie() {
return xingbie;
}
/**
*
*/
// 设置nianling字段值的方法用于设置用户年龄
public void setNianling(String nianling) {
this.nianling = nianling;
}
/**
*
*/
// 获取nianling字段值的方法返回用户年龄
public String getNianling() {
return nianling;
}
/**
*
*/
// 设置muqianzhiye字段值的方法用于设置用户目前的职业
public void setMuqianzhiye(String muqianzhiye) {
this.muqianzhiye = muqianzhiye;
}
/**
*
*/
// 获取muqianzhiye字段值的方法返回用户目前的职业
public String getMuqianzhiye() {
return muqianzhiye;
}
}
}

@ -1,95 +1,104 @@
// 声明包名为com.interceptor标识该类的存储路径
package com.interceptor;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
// 导入所需的Java类和库
import java.io.IOException; // 用于处理输入输出异常
import java.io.PrintWriter; // 用于向客户端输出文本数据
import java.util.HashMap; // 提供哈希映射数据结构
import java.util.Map; // 提供映射接口
import com.alibaba.fastjson.JSONObject; // 阿里巴巴的JSON处理工具
import javax.servlet.http.HttpServletRequest; // 提供HTTP请求对象
import javax.servlet.http.HttpServletResponse; // 提供HTTP响应对象
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.http.HttpStatus;
// 导入Apache Commons工具类
import org.apache.commons.lang3.StringUtils; // 字符串处理工具类
// 导入Spring框架相关类
import org.springframework.beans.factory.annotation.Autowired; // 实现依赖注入
import org.springframework.stereotype.Component; // 声明为Spring组件
import org.springframework.web.method.HandlerMethod; // 处理方法元数据封装类
import org.springframework.web.servlet.HandlerInterceptor; // Spring拦截器接口
import org.springframework.web.bind.annotation.RequestMethod; // HTTP请求方法枚举
import org.springframework.http.HttpStatus; // HTTP状态码封装类
import com.annotation.IgnoreAuth;
import com.entity.EIException;
import com.entity.TokenEntity;
import com.service.TokenService;
import com.utils.R;
// 导入自定义注解和类
import com.annotation.IgnoreAuth; // 自定义的跳过验证注解
import com.entity.EIException; // 自定义异常类
import com.entity.TokenEntity; // Token实体类
import com.service.TokenService; // Token服务接口
import com.utils.R; // 统一响应格式工具类
/**
* (Token)
* (Token)
*/
@Component
public class AuthorizationInterceptor implements HandlerInterceptor {
@Component // 声明为Spring管理的组件
public class AuthorizationInterceptor implements HandlerInterceptor { // 实现拦截器接口
// 定义登录Token在请求头中的键名
public static final String LOGIN_TOKEN_KEY = "Token";
@Autowired
@Autowired // 自动注入TokenService实例
private TokenService tokenService;
@Override
// 实现拦截器的前置处理方法
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//支持跨域请求
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization");
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
// 跨域时会首先发送一个OPTIONS请求这里我们给OPTIONS请求直接返回正常状态
if (request.getMethod().equals(RequestMethod.OPTIONS.name())) {
response.setStatus(HttpStatus.OK.value());
return false;
// 设置跨域请求相关响应头
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); // 允许的HTTP方法
response.setHeader("Access-Control-Max-Age", "3600"); // 预检请求缓存时间(秒)
response.setHeader("Access-Control-Allow-Credentials", "true"); // 允许携带凭证
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization"); // 允许的请求头
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); // 允许的请求来源
// 处理OPTIONS预检请求直接返回成功状态
if (request.getMethod().equals(RequestMethod.OPTIONS.name())) {
response.setStatus(HttpStatus.OK.value()); // 设置HTTP状态码为200
return false; // 终止请求处理流程
}
// 检查处理方法是否标注了IgnoreAuth注解
IgnoreAuth annotation;
if (handler instanceof HandlerMethod) {
annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class);
if (handler instanceof HandlerMethod) { // 判断是否为方法处理器
annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class); // 获取方法上的注解
} else {
return true;
return true; // 非方法处理器直接放行
}
//从header中获取token
// 从请求头中获取Token值
String token = request.getHeader(LOGIN_TOKEN_KEY);
/**
*
*/
// 如果方法标注了IgnoreAuth注解则跳过验证
if(annotation!=null) {
return true;
return true; // 放行请求
}
// Token验证逻辑
TokenEntity tokenEntity = null;
if(StringUtils.isNotBlank(token)) {
tokenEntity = tokenService.getTokenEntity(token);
if(StringUtils.isNotBlank(token)) { // 检查Token是否非空
tokenEntity = tokenService.getTokenEntity(token); // 查询Token有效性
}
// 验证成功时将用户信息存入Session
if(tokenEntity != null) {
request.getSession().setAttribute("userId", tokenEntity.getUserid());
request.getSession().setAttribute("role", tokenEntity.getRole());
request.getSession().setAttribute("tableName", tokenEntity.getTablename());
request.getSession().setAttribute("username", tokenEntity.getUsername());
return true;
request.getSession().setAttribute("userId", tokenEntity.getUserid()); // 用户ID
request.getSession().setAttribute("role", tokenEntity.getRole()); // 用户角色
request.getSession().setAttribute("tableName", tokenEntity.getTablename()); // 表名(可能用于数据隔离)
request.getSession().setAttribute("username", tokenEntity.getUsername()); // 用户名
return true; // 验证通过,放行请求
}
// Token验证失败时的响应处理
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8"); // 设置响应编码
response.setContentType("application/json; charset=utf-8"); // 设置响应类型为JSON
try {
writer = response.getWriter(); // 获取响应输出流
writer.print(JSONObject.toJSONString(R.error(401, "请先登录"))); // 输出JSON格式错误信息
} finally {
if(writer != null){
writer.close(); // 确保关闭输出流
}
}
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
try {
writer = response.getWriter();
writer.print(JSONObject.toJSONString(R.error(401, "请先登录")));
} finally {
if(writer != null){
writer.close();
}
}
// throw new EIException("请先登录", 401);
return false;
return false; // 拦截请求
}
}
}

@ -1,62 +1,93 @@
// 声明该类所在的包为com.service.impl
package com.service.impl;
// 导入Spring框架的Service注解用于标记该类为服务层组件
import org.springframework.stereotype.Service;
// 导入Java的Map接口用于处理键值对数据
import java.util.Map;
// 导入Java的List接口用于处理列表数据
import java.util.List;
// 导入MyBatis-Plus的Wrapper接口用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入MyBatis-Plus的EntityWrapper类用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的Page类用于分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入MyBatis-Plus的ServiceImpl类提供通用的服务层实现
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入Chat数据访问对象
import com.dao.ChatDao;
// 导入Chat实体类
import com.entity.ChatEntity;
// 导入Chat服务接口
import com.service.ChatService;
// 导入Chat值对象类
import com.entity.vo.ChatVO;
// 导入Chat视图类
import com.entity.view.ChatView;
// 标记该类为Spring的服务组件名称为chatService
@Service("chatService")
// 定义ChatServiceImpl类继承ServiceImpl类并实现ChatService接口
public class ChatServiceImpl extends ServiceImpl<ChatDao, ChatEntity> implements ChatService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<ChatEntity> page = this.selectPage(
new Query<ChatEntity>(params).getPage(),
new EntityWrapper<ChatEntity>()
);
return new PageUtils(page);
}
@Override
// 重写queryPage方法用于根据参数查询Chat实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数进行初始化
Page<ChatEntity> page = this.selectPage(
new Query<ChatEntity>(params).getPage(),
// 创建一个查询条件包装器
new EntityWrapper<ChatEntity>()
);
// 返回分页工具类对象,包含分页信息
return new PageUtils(page);
}
// 重写queryPage方法用于根据参数和查询条件查询Chat视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ChatEntity> wrapper) {
Page<ChatView> page =new Query<ChatView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数进行初始化
Page<ChatView> page = new Query<ChatView>(params).getPage();
// 设置分页对象的记录列表通过基础映射器的selectListView方法查询
page.setRecords(baseMapper.selectListView(page, wrapper));
// 创建分页工具类对象,包含分页信息
PageUtils pageUtil = new PageUtils(page);
// 返回分页工具类对象
return pageUtil;
}
// 重写selectListVO方法用于根据查询条件查询Chat值对象的列表数据
@Override
public List<ChatVO> selectListVO(Wrapper<ChatEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的selectListVO方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写selectVO方法用于根据查询条件查询单个Chat值对象
@Override
public ChatVO selectVO(Wrapper<ChatEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的selectVO方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写selectListView方法用于根据查询条件查询Chat视图的列表数据
@Override
public List<ChatView> selectListView(Wrapper<ChatEntity> wrapper) {
// 调用基础映射器的selectListView方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写selectView方法用于根据查询条件查询单个Chat视图
@Override
public ChatView selectView(Wrapper<ChatEntity> wrapper) {
// 调用基础映射器的selectView方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,558 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 Java 的 ArrayList 类,用于创建动态数组
import java.util.ArrayList;
// 导入 Java 的 HashMap 类,用于存储键值对集合
import java.util.HashMap;
// 导入 Java 的 Date 类,用于处理日期和时间
import java.util.Date;
// 导入 Java 的 Calendar 类,用于进行日期和时间的计算
import java.util.Calendar;
// 导入 Java 的 Collections 类,用于对集合进行操作
import java.util.Collections;
// 导入 Java 的 Comparator 接口,用于自定义排序规则
import java.util.Comparator;
// 导入 Java 的 Optional 类,用于处理可能为空的值
import java.util.Optional;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入试卷数据访问对象
import com.dao.ExampaperDao;
// 导入试卷实体类
import com.entity.ExampaperEntity;
// 导入试卷服务接口
import com.service.ExampaperService;
// 导入试卷值对象类
import com.entity.vo.ExampaperVO;
// 导入试卷视图类
import com.entity.view.ExampaperView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 exampaperService
@Service("exampaperService")
// 定义试卷服务实现类,继承自 ServiceImpl 并实现 ExampaperService 接口
public class ExampaperServiceImpl extends ServiceImpl<ExampaperDao, ExampaperEntity> implements ExampaperService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<ExampaperEntity> page = this.selectPage(
new Query<ExampaperEntity>(params).getPage(),
new EntityWrapper<ExampaperEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询试卷实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成
Page<ExampaperEntity> page = this.selectPage(
new Query<ExampaperEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<ExampaperEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询试卷视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ExampaperEntity> wrapper) {
Page<ExampaperView> page =new Query<ExampaperView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成,用于存储试卷视图数据
Page<ExampaperView> page = new Query<ExampaperView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取试卷视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询试卷值对象列表
@Override
public List<ExampaperVO> selectListVO(Wrapper<ExampaperEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个试卷值对象
@Override
public ExampaperVO selectVO(Wrapper<ExampaperEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询试卷视图列表
@Override
public List<ExampaperView> selectListView(Wrapper<ExampaperEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个试卷视图
@Override
public ExampaperView selectView(Wrapper<ExampaperEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
// 新增方法:根据试卷名称查询试卷视图列表
public List<ExampaperView> selectListViewByName(String paperName) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加试卷名称等于指定名称的查询条件
wrapper.eq("paper_name", paperName);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据考试科目查询试卷视图列表
public List<ExampaperView> selectListViewBySubject(String subject) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加考试科目等于指定科目的查询条件
wrapper.eq("subject", subject);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据考试时间范围查询试卷视图列表
public List<ExampaperView> selectListViewByExamTimeRange(Date startDate, Date endDate) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加考试时间大于等于开始日期的查询条件
wrapper.ge("exam_time", startDate);
// 添加考试时间小于等于结束日期的查询条件
wrapper.le("exam_time", endDate);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据试卷总分范围查询试卷视图列表
public List<ExampaperView> selectListViewByTotalScoreRange(int minScore, int maxScore) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加试卷总分大于等于最低分数的查询条件
wrapper.ge("total_score", minScore);
// 添加试卷总分小于等于最高分数的查询条件
wrapper.le("total_score", maxScore);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据试卷名称和考试科目查询试卷视图列表
public List<ExampaperView> selectListViewByNameAndSubject(String paperName, String subject) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加试卷名称等于指定名称的查询条件
wrapper.eq("paper_name", paperName);
// 添加考试科目等于指定科目的查询条件
wrapper.eq("subject", subject);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据试卷名称统计试卷数量
public int countPapersByName(String paperName) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加试卷名称等于指定名称的查询条件
wrapper.eq("paper_name", paperName);
// 调用基础映射器的 selectCount 方法统计试卷数量
return this.selectCount(wrapper);
}
// 新增方法:根据考试科目统计试卷数量
public int countPapersBySubject(String subject) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加考试科目等于指定科目的查询条件
wrapper.eq("subject", subject);
// 调用基础映射器的 selectCount 方法统计试卷数量
return this.selectCount(wrapper);
}
// 新增方法:根据考试时间范围统计试卷数量
public int countPapersByExamTimeRange(Date startDate, Date endDate) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加考试时间大于等于开始日期的查询条件
wrapper.ge("exam_time", startDate);
// 添加考试时间小于等于结束日期的查询条件
wrapper.le("exam_time", endDate);
// 调用基础映射器的 selectCount 方法统计试卷数量
return this.selectCount(wrapper);
}
// 新增方法:根据试卷总分范围统计试卷数量
public int countPapersByTotalScoreRange(int minScore, int maxScore) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加试卷总分大于等于最低分数的查询条件
wrapper.ge("total_score", minScore);
// 添加试卷总分小于等于最高分数的查询条件
wrapper.le("total_score", maxScore);
// 调用基础映射器的 selectCount 方法统计试卷数量
return this.selectCount(wrapper);
}
// 新增方法:根据试卷名称和考试科目统计试卷数量
public int countPapersByNameAndSubject(String paperName, String subject) {
// 创建一个查询条件包装器
Wrapper<ExampaperEntity> wrapper = new EntityWrapper<>();
// 添加试卷名称等于指定名称的查询条件
wrapper.eq("paper_name", paperName);
// 添加考试科目等于指定科目的查询条件
wrapper.eq("subject", subject);
// 调用基础映射器的 selectCount 方法统计试卷数量
return this.selectCount(wrapper);
}
// 新增方法:更新试卷的总分
public boolean updateTotalScore(int paperId, int newTotalScore) {
// 创建一个试卷实体对象
ExampaperEntity entity = new ExampaperEntity();
// 设置试卷 ID
entity.setId(paperId);
// 设置新的总分
entity.setTotalScore(newTotalScore);
// 调用基础映射器的 updateById 方法更新试卷信息
return this.updateById(entity);
}
// 新增方法:更新试卷的考试时间
public boolean updateExamTime(int paperId, Date newExamTime) {
// 创建一个试卷实体对象
ExampaperEntity entity = new ExampaperEntity();
// 设置试卷 ID
entity.setId(paperId);
// 设置新的考试时间
entity.setExamTime(newExamTime);
// 调用基础映射器的 updateById 方法更新试卷信息
return this.updateById(entity);
}
// 新增方法:更新试卷的考试科目
public boolean updateSubject(int paperId, String newSubject) {
// 创建一个试卷实体对象
ExampaperEntity entity = new ExampaperEntity();
// 设置试卷 ID
entity.setId(paperId);
// 设置新的考试科目
entity.setSubject(newSubject);
// 调用基础映射器的 updateById 方法更新试卷信息
return this.updateById(entity);
}
// 新增方法:根据试卷 ID 删除试卷
public boolean deletePaperById(int paperId) {
// 调用基础映射器的 deleteById 方法删除试卷
return this.deleteById(paperId);
}
// 新增方法:批量删除试卷
public boolean deletePapersByIds(List<Integer> paperIds) {
// 遍历试卷 ID 列表
for (Integer id : paperIds) {
// 调用基础映射器的 deleteById 方法删除试卷
if (!this.deleteById(id)) {
// 如果删除失败,返回 false
return false;
}
}
// 所有删除操作都成功,返回 true
return true;
}
// 新增方法:根据试卷名称对试卷视图列表进行排序
public List<ExampaperView> sortPapersByName(List<ExampaperView> papers) {
// 使用 Collections.sort 方法对列表进行排序
Collections.sort(papers, Comparator.comparing(ExampaperView::getPaperName));
return papers;
}
// 新增方法:根据考试时间对试卷视图列表进行排序
public List<ExampaperView> sortPapersByExamTime(List<ExampaperView> papers) {
// 使用 Collections.sort 方法对列表进行排序
Collections.sort(papers, Comparator.comparing(ExampaperView::getExamTime));
return papers;
}
// 新增方法:根据试卷总分对试卷视图列表进行排序
public List<ExampaperView> sortPapersByTotalScore(List<ExampaperView> papers) {
// 使用 Collections.sort 方法对列表进行排序
Collections.sort(papers, Comparator.comparingInt(ExampaperView::getTotalScore));
return papers;
}
// 新增方法:获取指定考试科目中总分最高的试卷
public Optional<ExampaperView> getHighestTotalScorePaperBySubject(String subject) {
// 根据考试科目查询试卷视图列表
List<ExampaperView> papers = selectListViewBySubject(subject);
if (papers.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
// 使用 Collections.max 方法找出总分最高的试卷
ExampaperView highestScorePaper = Collections.max(papers, Comparator.comparingInt(ExampaperView::getTotalScore));
// 返回包含总分最高试卷的 Optional 对象
return Optional.of(highestScorePaper);
}
// 新增方法:获取指定考试科目中总分最低的试卷
public Optional<ExampaperView> getLowestTotalScorePaperBySubject(String subject) {
// 根据考试科目查询试卷视图列表
List<ExampaperView> papers = selectListViewBySubject(subject);
if (papers.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
// 使用 Collections.min 方法找出总分最低的试卷
ExampaperView lowestScorePaper = Collections.min(papers, Comparator.comparingInt(ExampaperView::getTotalScore));
// 返回包含总分最低试卷的 Optional 对象
return Optional.of(lowestScorePaper);
}
// 新增方法:获取指定考试时间范围内最早的试卷
public Optional<ExampaperView> getEarliestPaperByExamTimeRange(Date startDate, Date endDate) {
// 根据考试时间范围查询试卷视图列表
List<ExampaperView> papers = selectListViewByExamTimeRange(startDate, endDate);
if (papers.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
// 使用 Collections.min 方法找出最早的试卷
ExampaperView earliestPaper = Collections.min(papers, Comparator.comparing(ExampaperView::getExamTime));
// 返回包含最早试卷的 Optional 对象
return Optional.of(earliestPaper);
}
// 新增方法:获取指定考试时间范围内最晚的试卷
public Optional<ExampaperView> getLatestPaperByExamTimeRange(Date startDate, Date endDate) {
// 根据考试时间范围查询试卷视图列表
List<ExampaperView> papers = selectListViewByExamTimeRange(startDate, endDate);
if (papers.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
// 使用 Collections.max 方法找出最晚的试卷
ExampaperView latestPaper = Collections.max(papers, Comparator.comparing(ExampaperView::getExamTime));
// 返回包含最晚试卷的 Optional 对象
return Optional.of(latestPaper);
}
// 新增方法:根据考试科目分组统计试卷数量
public Map<String, Integer> countPapersBySubject() {
// 创建一个 HashMap 用于存储统计结果
Map<String, Integer> subjectCountMap = new HashMap<>();
// 查询所有试卷视图列表
List<ExampaperView> papers = selectListView(null);
// 遍历试卷视图列表
for (ExampaperView paper : papers) {
String subject = paper.getSubject();
// 如果该考试科目已经在 Map 中,增加其计数
subjectCountMap.put(subject, subjectCountMap.getOrDefault(subject, 0) + 1);
}
return subjectCountMap;
}
// 新增方法:根据试卷总分范围分组统计试卷数量
public Map<String, Integer> countPapersByTotalScoreRanges(List<int[]> scoreRanges) {
// 创建一个 HashMap 用于存储统计结果
Map<String, Integer> scoreRangeCountMap = new HashMap<>();
// 查询所有试卷视图列表
List<ExampaperView> papers = selectListView(null);
// 遍历分数范围列表
for (int[] range : scoreRanges) {
int minScore = range[0];
int maxScore = range[1];
String rangeKey = minScore + "-" + maxScore;
int count = 0;
// 遍历试卷视图列表
for (ExampaperView paper : papers) {
int totalScore = paper.getTotalScore();
if (totalScore >= minScore && totalScore <= maxScore) {
// 如果试卷总分在该范围内,增加计数
count++;
}
}
// 将该分数范围的计数存入 Map
scoreRangeCountMap.put(rangeKey, count);
}
return scoreRangeCountMap;
}
// 新增方法:根据考试时间的月份分组统计试卷数量
public Map<Integer, Integer> countPapersByExamMonth() {
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Integer> monthCountMap = new HashMap<>();
// 查询所有试卷视图列表
List<ExampaperView> papers = selectListView(null);
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历试卷视图列表
for (ExampaperView paper : papers) {
calendar.setTime(paper.getExamTime());
int month = calendar.get(Calendar.MONTH) + 1;
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return monthCountMap;
}
// 新增方法:根据考试科目和试卷总分范围分组统计试卷数量
public Map<String, Map<String, Integer>> countPapersBySubjectAndTotalScoreRanges(List<int[]> scoreRanges) {
// 创建一个 HashMap 用于存储统计结果
Map<String, Map<String, Integer>> subjectScoreRangeCountMap = new HashMap<>();
// 查询所有试卷视图列表
List<ExampaperView> papers = selectListView(null);
// 遍历分数范围列表
for (int[] range : scoreRanges) {
int minScore = range[0];
int maxScore = range[1];
String rangeKey = minScore + "-" + maxScore;
// 遍历试卷视图列表
for (ExampaperView paper : papers) {
String subject = paper.getSubject();
int totalScore = paper.getTotalScore();
if (totalScore >= minScore && totalScore <= maxScore) {
// 获取该考试科目对应的分数范围计数 Map
Map<String, Integer> scoreRangeCountMap = subjectScoreRangeCountMap.computeIfAbsent(subject, k -> new HashMap<>());
// 如果该分数范围已经在 Map 中,增加其计数
scoreRangeCountMap.put(rangeKey, scoreRangeCountMap.getOrDefault(rangeKey, 0) + 1);
}
}
}
return subjectScoreRangeCountMap;
}
// 新增方法:根据考试科目和考试时间的月份分组统计试卷数量
public Map<String, Map<Integer, Integer>> countPapersBySubjectAndExamMonth() {
// 创建一个 HashMap 用于存储统计结果
Map<String, Map<Integer, Integer>> subjectMonthCountMap = new HashMap<>();
// 查询所有试卷视图列表
List<ExampaperView> papers = selectListView(null);
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历试卷视图列表
for (ExampaperView paper : papers) {
String subject = paper.getSubject();
calendar.setTime(paper.getExamTime());
int month = calendar.get(Calendar.MONTH) + 1;
// 获取该考试科目对应的月份计数 Map
Map<Integer, Integer> monthCountMap = subjectMonthCountMap.computeIfAbsent(subject, k -> new HashMap<>());
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return subjectMonthCountMap;
}
// 新增方法:根据试卷总分和考试时间的月份分组统计试卷数量
public Map<Integer, Map<Integer, Integer>> countPapersByTotalScoreAndExamMonth() {
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Map<Integer, Integer>> scoreMonthCountMap = new HashMap<>();
// 查询所有试卷视图列表
List<ExampaperView> papers = selectListView(null);
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历试卷视图列表
for (ExampaperView paper : papers) {
int totalScore = paper.getTotalScore();
calendar.setTime(paper.getExamTime());
int month = calendar.get(Calendar.MONTH) + 1;
// 获取该总分对应的月份计数 Map
Map<Integer, Integer> monthCountMap = scoreMonthCountMap.computeIfAbsent(totalScore, k -> new HashMap<>());
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return scoreMonthCountMap;
}
// 新增方法:获取指定考试科目下的平均总分
public Optional<Double> getAverageTotalScoreBySubject(String subject) {
// 根据考试科目查询试卷视图列表
List<ExampaperView> papers = selectListViewBySubject(subject);
if (papers.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int totalScoreSum = 0;
// 遍历试卷视图列表
for (ExampaperView paper : papers) {
totalScoreSum += paper.getTotalScore();
}
// 计算平均总分
double averageTotalScore = (double) totalScoreSum / papers.size();
// 返回包含平均总分的 Optional 对象
return Optional.of(averageTotalScore);
}
// 新增方法:获取指定考试时间范围内的平均总分
public Optional<Double> getAverageTotalScoreByExamTimeRange(Date startDate, Date endDate) {
// 根据考试时间范围查询试卷视图列表
List<ExampaperView> papers = selectListViewByExamTimeRange(startDate, endDate);
if (papers.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int totalScoreSum = 0;
// 遍历试卷视图列表
for (ExampaperView paper : papers) {
totalScoreSum += paper.getTotalScore();
}
// 计算平均总分
double averageTotalScore = (double) totalScoreSum / papers.size();
// 返回包含平均总分的 Optional 对象
return Optional.of(averageTotalScore);
}
// 新增方法:获取试卷数量最多的考试科目
public Optional<String> getMostFrequentSubject() {
// 根据考试科目分组统计试卷数量
Map<String, Integer> subjectCountMap = countPapersBySubject();
if (subjectCountMap.isEmpty()) {
// 如果 Map 为空,返回空的 Optional 对象
return Optional.empty();
}
// 找出数量最多的考试科目
String mostFrequentSubject = Collections.max(subjectCountMap.entrySet(), Map.Entry.comparingByValue()).getKey();
// 返回包含数量最多考试科目的 Optional 对象
return Optional.of(mostFrequentSubject);
}
// 新增方法:获取试卷数量最多的总分范围
public Optional<String> getMostFrequentTotalScoreRange(List<int[]> scoreRanges) {
// 根据试卷总分范围分组统计试卷数量
Map<String, Integer> scoreRangeCountMap = countPapersByTotalScoreRanges(scoreRanges);
if (scoreRangeCountMap.isEmpty()) {
// 如果 Map 为空,返回空的 Optional 对象
return Optional.empty();
}
// 找出数量最多的总分范围
String mostFrequentScoreRange = Collections.max(scoreRangeCountMap.entrySet(), Map.Entry.comparingByValue()).getKey();
// 返回包含数量最多总分范围的 Optional 对象
return Optional.of(mostFrequentScoreRange);
}
// 新增方法:获取试卷数量最多的考试月份
public Optional<Integer> getMostFrequentExamMonth() {
// 根据考试时间的月份分组统计试卷数量
Map<Integer, Integer> monthCountMap = countPapersByExamMonth();
if (monthCountMap.isEmpty()) {
// 如果 Map 为空,返回空的 Optional 对象
return Optional.empty();
}
// 找出数量最多的考试月份
Integer mostFrequentMonth = Collections.max(monthCountMap.entrySet(), Map.Entry.comparingByValue()).getKey();
// 返回包含数量最多考试月份的 Optional 对象
return Optional.of(mostFrequentMonth);
}
}

@ -1,62 +1,505 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 Java 的 ArrayList 类,用于动态数组操作
import java.util.ArrayList;
// 导入 Java 的 HashMap 类,用于存储键值对数据
import java.util.HashMap;
// 导入 Java 的 Date 类,用于处理日期和时间
import java.util.Date;
// 导入 Java 的 Calendar 类,用于日期和时间的计算
import java.util.Calendar;
// 导入 Java 的 Collections 类,用于对集合进行操作
import java.util.Collections;
// 导入 Java 的 Comparator 接口,用于自定义排序规则
import java.util.Comparator;
// 导入 Java 的 Optional 类,用于处理可能为空的值
import java.util.Optional;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入考试问题数据访问对象
import com.dao.ExamquestionDao;
// 导入考试问题实体类
import com.entity.ExamquestionEntity;
// 导入考试问题服务接口
import com.service.ExamquestionService;
// 导入考试问题值对象类
import com.entity.vo.ExamquestionVO;
// 导入考试问题视图类
import com.entity.view.ExamquestionView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 examquestionService
@Service("examquestionService")
// 定义考试问题服务实现类,继承自 ServiceImpl 并实现 ExamquestionService 接口
public class ExamquestionServiceImpl extends ServiceImpl<ExamquestionDao, ExamquestionEntity> implements ExamquestionService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<ExamquestionEntity> page = this.selectPage(
new Query<ExamquestionEntity>(params).getPage(),
new EntityWrapper<ExamquestionEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询考试问题实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成
Page<ExamquestionEntity> page = this.selectPage(
new Query<ExamquestionEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<ExamquestionEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询考试问题视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ExamquestionEntity> wrapper) {
Page<ExamquestionView> page =new Query<ExamquestionView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成,用于存储考试问题视图数据
Page<ExamquestionView> page = new Query<ExamquestionView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取考试问题视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询考试问题值对象列表
@Override
public List<ExamquestionVO> selectListVO(Wrapper<ExamquestionEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个考试问题值对象
@Override
public ExamquestionVO selectVO(Wrapper<ExamquestionEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询考试问题视图列表
@Override
public List<ExamquestionView> selectListView(Wrapper<ExamquestionEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个考试问题视图
@Override
public ExamquestionView selectView(Wrapper<ExamquestionEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
// 新增方法:根据问题类型查询考试问题视图列表
public List<ExamquestionView> selectListViewByQuestionType(String questionType) {
// 创建一个查询条件包装器
Wrapper<ExamquestionEntity> wrapper = new EntityWrapper<>();
// 添加问题类型等于指定类型的查询条件
wrapper.eq("question_type", questionType);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据问题难度查询考试问题视图列表
public List<ExamquestionView> selectListViewByDifficultyLevel(int difficultyLevel) {
// 创建一个查询条件包装器
Wrapper<ExamquestionEntity> wrapper = new EntityWrapper<>();
// 添加问题难度等于指定难度的查询条件
wrapper.eq("difficulty_level", difficultyLevel);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据创建时间范围查询考试问题视图列表
public List<ExamquestionView> selectListViewByCreateTimeRange(Date startDate, Date endDate) {
// 创建一个查询条件包装器
Wrapper<ExamquestionEntity> wrapper = new EntityWrapper<>();
// 添加创建时间大于等于开始日期的查询条件
wrapper.ge("create_time", startDate);
// 添加创建时间小于等于结束日期的查询条件
wrapper.le("create_time", endDate);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据问题类型和难度级别查询考试问题视图列表
public List<ExamquestionView> selectListViewByTypeAndDifficulty(String questionType, int difficultyLevel) {
// 创建一个查询条件包装器
Wrapper<ExamquestionEntity> wrapper = new EntityWrapper<>();
// 添加问题类型等于指定类型的查询条件
wrapper.eq("question_type", questionType);
// 添加问题难度等于指定难度的查询条件
wrapper.eq("difficulty_level", difficultyLevel);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据问题类型统计考试问题数量
public int countQuestionsByType(String questionType) {
// 创建一个查询条件包装器
Wrapper<ExamquestionEntity> wrapper = new EntityWrapper<>();
// 添加问题类型等于指定类型的查询条件
wrapper.eq("question_type", questionType);
// 调用基础映射器的 selectCount 方法统计数量
return this.selectCount(wrapper);
}
// 新增方法:根据问题难度统计考试问题数量
public int countQuestionsByDifficulty(int difficultyLevel) {
// 创建一个查询条件包装器
Wrapper<ExamquestionEntity> wrapper = new EntityWrapper<>();
// 添加问题难度等于指定难度的查询条件
wrapper.eq("difficulty_level", difficultyLevel);
// 调用基础映射器的 selectCount 方法统计数量
return this.selectCount(wrapper);
}
// 新增方法:根据创建时间范围统计考试问题数量
public int countQuestionsByCreateTimeRange(Date startDate, Date endDate) {
// 创建一个查询条件包装器
Wrapper<ExamquestionEntity> wrapper = new EntityWrapper<>();
// 添加创建时间大于等于开始日期的查询条件
wrapper.ge("create_time", startDate);
// 添加创建时间小于等于结束日期的查询条件
wrapper.le("create_time", endDate);
// 调用基础映射器的 selectCount 方法统计数量
return this.selectCount(wrapper);
}
// 新增方法:根据问题类型和难度级别统计考试问题数量
public int countQuestionsByTypeAndDifficulty(String questionType, int difficultyLevel) {
// 创建一个查询条件包装器
Wrapper<ExamquestionEntity> wrapper = new EntityWrapper<>();
// 添加问题类型等于指定类型的查询条件
wrapper.eq("question_type", questionType);
// 添加问题难度等于指定难度的查询条件
wrapper.eq("difficulty_level", difficultyLevel);
// 调用基础映射器的 selectCount 方法统计数量
return this.selectCount(wrapper);
}
// 新增方法:更新考试问题的难度级别
public boolean updateQuestionDifficulty(int questionId, int newDifficultyLevel) {
// 创建一个考试问题实体对象
ExamquestionEntity entity = new ExamquestionEntity();
// 设置问题 ID
entity.setId(questionId);
// 设置新的难度级别
entity.setDifficultyLevel(newDifficultyLevel);
// 调用基础映射器的 updateById 方法更新问题
return this.updateById(entity);
}
// 新增方法:更新考试问题的类型
public boolean updateQuestionType(int questionId, String newQuestionType) {
// 创建一个考试问题实体对象
ExamquestionEntity entity = new ExamquestionEntity();
// 设置问题 ID
entity.setId(questionId);
// 设置新的问题类型
entity.setQuestionType(newQuestionType);
// 调用基础映射器的 updateById 方法更新问题
return this.updateById(entity);
}
// 新增方法:根据问题 ID 删除考试问题
public boolean deleteQuestionById(int questionId) {
// 调用基础映射器的 deleteById 方法删除问题
return this.deleteById(questionId);
}
// 新增方法:批量删除考试问题
public boolean deleteQuestionsByIds(List<Integer> questionIds) {
// 遍历问题 ID 列表
for (Integer id : questionIds) {
// 调用基础映射器的 deleteById 方法删除问题
if (!this.deleteById(id)) {
// 如果删除失败,返回 false
return false;
}
}
// 所有删除操作都成功,返回 true
return true;
}
// 新增方法:根据问题类型对考试问题视图列表进行排序
public List<ExamquestionView> sortQuestionsByType(List<ExamquestionView> questions) {
// 使用 Collections.sort 方法对列表进行排序
Collections.sort(questions, Comparator.comparing(ExamquestionView::getQuestionType));
return questions;
}
// 新增方法:根据问题难度对考试问题视图列表进行排序
public List<ExamquestionView> sortQuestionsByDifficulty(List<ExamquestionView> questions) {
// 使用 Collections.sort 方法对列表进行排序
Collections.sort(questions, Comparator.comparingInt(ExamquestionView::getDifficultyLevel));
return questions;
}
// 新增方法:根据创建时间对考试问题视图列表进行排序
public List<ExamquestionView> sortQuestionsByCreateTime(List<ExamquestionView> questions) {
// 使用 Collections.sort 方法对列表进行排序
Collections.sort(questions, Comparator.comparing(ExamquestionView::getCreateTime));
return questions;
}
// 新增方法:获取指定问题类型中难度最高的问题
public Optional<ExamquestionView> getHighestDifficultyQuestionByType(String questionType) {
// 根据问题类型查询考试问题视图列表
List<ExamquestionView> questions = selectListViewByQuestionType(questionType);
if (questions.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
// 使用 Collections.max 方法找出难度最高的问题
ExamquestionView highestDifficultyQuestion = Collections.max(questions, Comparator.comparingInt(ExamquestionView::getDifficultyLevel));
// 返回包含难度最高问题的 Optional 对象
return Optional.of(highestDifficultyQuestion);
}
// 新增方法:获取指定问题类型中难度最低的问题
public Optional<ExamquestionView> getLowestDifficultyQuestionByType(String questionType) {
// 根据问题类型查询考试问题视图列表
List<ExamquestionView> questions = selectListViewByQuestionType(questionType);
if (questions.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
// 使用 Collections.min 方法找出难度最低的问题
ExamquestionView lowestDifficultyQuestion = Collections.min(questions, Comparator.comparingInt(ExamquestionView::getDifficultyLevel));
// 返回包含难度最低问题的 Optional 对象
return Optional.of(lowestDifficultyQuestion);
}
// 新增方法:获取指定难度级别下最早创建的问题
public Optional<ExamquestionView> getEarliestQuestionByDifficulty(int difficultyLevel) {
// 根据问题难度查询考试问题视图列表
List<ExamquestionView> questions = selectListViewByDifficultyLevel(difficultyLevel);
if (questions.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
// 使用 Collections.min 方法找出最早创建的问题
ExamquestionView earliestQuestion = Collections.min(questions, Comparator.comparing(ExamquestionView::getCreateTime));
// 返回包含最早创建问题的 Optional 对象
return Optional.of(earliestQuestion);
}
// 新增方法:获取指定难度级别下最晚创建的问题
public Optional<ExamquestionView> getLatestQuestionByDifficulty(int difficultyLevel) {
// 根据问题难度查询考试问题视图列表
List<ExamquestionView> questions = selectListViewByDifficultyLevel(difficultyLevel);
if (questions.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
// 使用 Collections.max 方法找出最晚创建的问题
ExamquestionView latestQuestion = Collections.max(questions, Comparator.comparing(ExamquestionView::getCreateTime));
// 返回包含最晚创建问题的 Optional 对象
return Optional.of(latestQuestion);
}
// 新增方法:根据问题类型分组统计考试问题数量
public Map<String, Integer> countQuestionsByType() {
// 创建一个 HashMap 用于存储统计结果
Map<String, Integer> typeCountMap = new HashMap<>();
// 查询所有考试问题视图列表
List<ExamquestionView> questions = selectListView(null);
// 遍历考试问题视图列表
for (ExamquestionView question : questions) {
String questionType = question.getQuestionType();
// 如果该问题类型已经在 Map 中,增加其计数
typeCountMap.put(questionType, typeCountMap.getOrDefault(questionType, 0) + 1);
}
return typeCountMap;
}
// 新增方法:根据问题难度分组统计考试问题数量
public Map<Integer, Integer> countQuestionsByDifficulty() {
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Integer> difficultyCountMap = new HashMap<>();
// 查询所有考试问题视图列表
List<ExamquestionView> questions = selectListView(null);
// 遍历考试问题视图列表
for (ExamquestionView question : questions) {
int difficultyLevel = question.getDifficultyLevel();
// 如果该难度级别已经在 Map 中,增加其计数
difficultyCountMap.put(difficultyLevel, difficultyCountMap.getOrDefault(difficultyLevel, 0) + 1);
}
return difficultyCountMap;
}
// 新增方法:根据创建时间的月份分组统计考试问题数量
public Map<Integer, Integer> countQuestionsByCreateMonth() {
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Integer> monthCountMap = new HashMap<>();
// 查询所有考试问题视图列表
List<ExamquestionView> questions = selectListView(null);
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历考试问题视图列表
for (ExamquestionView question : questions) {
calendar.setTime(question.getCreateTime());
int month = calendar.get(Calendar.MONTH) + 1;
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return monthCountMap;
}
// 新增方法:根据问题类型和难度级别分组统计考试问题数量
public Map<String, Map<Integer, Integer>> countQuestionsByTypeAndDifficulty() {
// 创建一个 HashMap 用于存储统计结果
Map<String, Map<Integer, Integer>> typeDifficultyCountMap = new HashMap<>();
// 查询所有考试问题视图列表
List<ExamquestionView> questions = selectListView(null);
// 遍历考试问题视图列表
for (ExamquestionView question : questions) {
String questionType = question.getQuestionType();
int difficultyLevel = question.getDifficultyLevel();
// 获取该问题类型对应的难度级别计数 Map
Map<Integer, Integer> difficultyCountMap = typeDifficultyCountMap.computeIfAbsent(questionType, k -> new HashMap<>());
// 如果该难度级别已经在 Map 中,增加其计数
difficultyCountMap.put(difficultyLevel, difficultyCountMap.getOrDefault(difficultyLevel, 0) + 1);
}
return typeDifficultyCountMap;
}
// 新增方法:根据问题类型和创建时间的月份分组统计考试问题数量
public Map<String, Map<Integer, Integer>> countQuestionsByTypeAndCreateMonth() {
// 创建一个 HashMap 用于存储统计结果
Map<String, Map<Integer, Integer>> typeMonthCountMap = new HashMap<>();
// 查询所有考试问题视图列表
List<ExamquestionView> questions = selectListView(null);
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历考试问题视图列表
for (ExamquestionView question : questions) {
String questionType = question.getQuestionType();
calendar.setTime(question.getCreateTime());
int month = calendar.get(Calendar.MONTH) + 1;
// 获取该问题类型对应的月份计数 Map
Map<Integer, Integer> monthCountMap = typeMonthCountMap.computeIfAbsent(questionType, k -> new HashMap<>());
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return typeMonthCountMap;
}
// 新增方法:根据问题难度和创建时间的月份分组统计考试问题数量
public Map<Integer, Map<Integer, Integer>> countQuestionsByDifficultyAndCreateMonth() {
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Map<Integer, Integer>> difficultyMonthCountMap = new HashMap<>();
// 查询所有考试问题视图列表
List<ExamquestionView> questions = selectListView(null);
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历考试问题视图列表
for (ExamquestionView question : questions) {
int difficultyLevel = question.getDifficultyLevel();
calendar.setTime(question.getCreateTime());
int month = calendar.get(Calendar.MONTH) + 1;
// 获取该难度级别对应的月份计数 Map
Map<Integer, Integer> monthCountMap = difficultyMonthCountMap.computeIfAbsent(difficultyLevel, k -> new HashMap<>());
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return difficultyMonthCountMap;
}
// 新增方法:获取指定问题类型下的平均难度级别
public Optional<Double> getAverageDifficultyByType(String questionType) {
// 根据问题类型查询考试问题视图列表
List<ExamquestionView> questions = selectListViewByQuestionType(questionType);
if (questions.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int totalDifficulty = 0;
// 遍历考试问题视图列表
for (ExamquestionView question : questions) {
totalDifficulty += question.getDifficultyLevel();
}
// 计算平均难度级别
double averageDifficulty = (double) totalDifficulty / questions.size();
// 返回包含平均难度级别的 Optional 对象
return Optional.of(averageDifficulty);
}
// 新增方法:获取指定难度级别下的平均创建时间
public Optional<Date> getAverageCreateTimeByDifficulty(int difficultyLevel) {
// 根据问题难度查询考试问题视图列表
List<ExamquestionView> questions = selectListViewByDifficultyLevel(difficultyLevel);
if (questions.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
long totalTime = 0;
// 遍历考试问题视图列表
for (ExamquestionView question : questions) {
totalTime += question.getCreateTime().getTime();
}
// 计算平均创建时间
long averageTime = totalTime / questions.size();
// 创建包含平均创建时间的 Date 对象
Date averageCreateTime = new Date(averageTime);
// 返回包含平均创建时间的 Optional 对象
return Optional.of(averageCreateTime);
}
// 新增方法:获取考试问题数量最多的问题类型
public Optional<String> getMostFrequentQuestionType() {
// 根据问题类型分组统计考试问题数量
Map<String, Integer> typeCountMap = countQuestionsByType();
if (typeCountMap.isEmpty()) {
// 如果 Map 为空,返回空的 Optional 对象
return Optional.empty();
}
// 找出数量最多的问题类型
String mostFrequentType = Collections.max(typeCountMap.entrySet(), Map.Entry.comparingByValue()).getKey();
// 返回包含数量最多问题类型的 Optional 对象
return Optional.of(mostFrequentType);
}
// 新增方法:获取考试问题数量最多的难度级别
public Optional<Integer> getMostFrequentDifficultyLevel() {
// 根据问题难度分组统计考试问题数量
Map<Integer, Integer> difficultyCountMap = countQuestionsByDifficulty();
if (difficultyCountMap.isEmpty()) {
// 如果 Map 为空,返回空的 Optional 对象
return Optional.empty();
}
// 找出数量最多的难度级别
Integer mostFrequentDifficulty = Collections.max(difficultyCountMap.entrySet(), Map.Entry.comparingByValue()).getKey();
// 返回包含数量最多难度级别的 Optional 对象
return Optional.of(mostFrequentDifficulty);
}
// 新增方法:获取考试问题数量最多的创建月份
public Optional<Integer> getMostFrequentCreateMonth() {
// 根据创建时间的月份分组统计考试问题数量
Map<Integer, Integer> monthCountMap = countQuestionsByCreateMonth();
if (monthCountMap.isEmpty()) {
// 如果 Map 为空,返回空的 Optional 对象
return Optional.empty();
}
// 找出数量最多的创建月份
Integer mostFrequentMonth = Collections.max(monthCountMap.entrySet(), Map.Entry.comparingByValue()).getKey();
// 返回包含数量最多创建月份的 Optional 对象
return Optional.of(mostFrequentMonth);
}
}

@ -1,69 +1,558 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 Java 的 ArrayList 类,用于实现动态数组
import java.util.ArrayList;
// 导入 Java 的 HashMap 类,用于实现哈希表
import java.util.HashMap;
// 导入 Java 的 Date 类,用于处理日期和时间
import java.util.Date;
// 导入 Java 的 Calendar 类,用于进行日期和时间的计算
import java.util.Calendar;
// 导入 Java 的 Collections 类,用于对集合进行操作
import java.util.Collections;
// 导入 Java 的 Comparator 接口,用于自定义排序规则
import java.util.Comparator;
// 导入 Java 的 Optional 类,用于处理可能为空的值
import java.util.Optional;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入考试记录数据访问对象
import com.dao.ExamrecordDao;
// 导入考试记录实体类
import com.entity.ExamrecordEntity;
// 导入考试记录服务接口
import com.service.ExamrecordService;
// 导入考试记录值对象类
import com.entity.vo.ExamrecordVO;
// 导入考试记录视图类
import com.entity.view.ExamrecordView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 examrecordService
@Service("examrecordService")
// 定义考试记录服务实现类,继承自 ServiceImpl 并实现 ExamrecordService 接口
public class ExamrecordServiceImpl extends ServiceImpl<ExamrecordDao, ExamrecordEntity> implements ExamrecordService {
// 重写 queryPageGroupBy 方法,根据传入的参数和查询条件按组查询考试记录视图的分页数据
@Override
public PageUtils queryPageGroupBy(Map<String, Object> params, Wrapper<ExamrecordEntity> wrapper) {
Page<ExamrecordView> page =new Query<ExamrecordView>(params).getPage();
page.setRecords(baseMapper.selectGroupBy(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<ExamrecordEntity> page = this.selectPage(
new Query<ExamrecordEntity>(params).getPage(),
new EntityWrapper<ExamrecordEntity>()
);
return new PageUtils(page);
}
@Override
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成,用于存储考试记录视图数据
Page<ExamrecordView> page = new Query<ExamrecordView>(params).getPage();
// 调用基础映射器的 selectGroupBy 方法,根据分页和查询条件获取按组查询的考试记录视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectGroupBy(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 queryPage 方法,根据传入的参数查询考试记录实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成
Page<ExamrecordEntity> page = this.selectPage(
new Query<ExamrecordEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<ExamrecordEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询考试记录视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ExamrecordEntity> wrapper) {
Page<ExamrecordView> page =new Query<ExamrecordView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成,用于存储考试记录视图数据
Page<ExamrecordView> page = new Query<ExamrecordView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取考试记录视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询考试记录值对象列表
@Override
public List<ExamrecordVO> selectListVO(Wrapper<ExamrecordEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个考试记录值对象
@Override
public ExamrecordVO selectVO(Wrapper<ExamrecordEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询考试记录视图列表
@Override
public List<ExamrecordView> selectListView(Wrapper<ExamrecordEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个考试记录视图
@Override
public ExamrecordView selectView(Wrapper<ExamrecordEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
// 新增方法:根据考试日期范围查询考试记录视图列表
public List<ExamrecordView> selectListViewByDateRange(Date startDate, Date endDate) {
// 创建一个查询条件包装器
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<>();
// 添加考试日期大于等于开始日期的查询条件
wrapper.ge("exam_date", startDate);
// 添加考试日期小于等于结束日期的查询条件
wrapper.le("exam_date", endDate);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据考试成绩范围查询考试记录视图列表
public List<ExamrecordView> selectListViewByScoreRange(int minScore, int maxScore) {
// 创建一个查询条件包装器
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<>();
// 添加考试成绩大于等于最低成绩的查询条件
wrapper.ge("score", minScore);
// 添加考试成绩小于等于最高成绩的查询条件
wrapper.le("score", maxScore);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据考试科目查询考试记录视图列表
public List<ExamrecordView> selectListViewBySubject(String subject) {
// 创建一个查询条件包装器
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<>();
// 添加考试科目等于指定科目的查询条件
wrapper.eq("subject", subject);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据学生 ID 查询考试记录视图列表
public List<ExamrecordView> selectListViewByStudentId(int studentId) {
// 创建一个查询条件包装器
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<>();
// 添加学生 ID 等于指定 ID 的查询条件
wrapper.eq("student_id", studentId);
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(new Page<>(1, Integer.MAX_VALUE), wrapper);
}
// 新增方法:根据考试记录 ID 批量删除考试记录
public boolean deleteExamRecordsByIds(List<Integer> ids) {
// 遍历 ID 列表
for (Integer id : ids) {
// 调用基础映射器的 deleteById 方法删除考试记录
if (!this.deleteById(id)) {
// 如果删除失败,返回 false
return false;
}
}
// 所有删除操作都成功,返回 true
return true;
}
// 新增方法:根据考试记录 ID 更新考试成绩
public boolean updateScoreById(int id, int newScore) {
// 创建一个考试记录实体对象
ExamrecordEntity entity = new ExamrecordEntity();
// 设置考试记录 ID
entity.setId(id);
// 设置新的考试成绩
entity.setScore(newScore);
// 调用基础映射器的 updateById 方法更新考试记录
return this.updateById(entity);
}
// 新增方法:根据考试记录 ID 更新考试日期
public boolean updateExamDateById(int id, Date newExamDate) {
// 创建一个考试记录实体对象
ExamrecordEntity entity = new ExamrecordEntity();
// 设置考试记录 ID
entity.setId(id);
// 设置新的考试日期
entity.setExamDate(newExamDate);
// 调用基础映射器的 updateById 方法更新考试记录
return this.updateById(entity);
}
// 新增方法:根据考试记录 ID 更新考试科目
public boolean updateSubjectById(int id, String newSubject) {
// 创建一个考试记录实体对象
ExamrecordEntity entity = new ExamrecordEntity();
// 设置考试记录 ID
entity.setId(id);
// 设置新的考试科目
entity.setSubject(newSubject);
// 调用基础映射器的 updateById 方法更新考试记录
return this.updateById(entity);
}
// 新增方法:统计指定日期范围内的考试记录数量
public int countExamRecordsByDateRange(Date startDate, Date endDate) {
// 创建一个查询条件包装器
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<>();
// 添加考试日期大于等于开始日期的查询条件
wrapper.ge("exam_date", startDate);
// 添加考试日期小于等于结束日期的查询条件
wrapper.le("exam_date", endDate);
// 调用基础映射器的 selectCount 方法统计考试记录数量
return this.selectCount(wrapper);
}
// 新增方法:统计指定成绩范围内的考试记录数量
public int countExamRecordsByScoreRange(int minScore, int maxScore) {
// 创建一个查询条件包装器
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<>();
// 添加考试成绩大于等于最低成绩的查询条件
wrapper.ge("score", minScore);
// 添加考试成绩小于等于最高成绩的查询条件
wrapper.le("score", maxScore);
// 调用基础映射器的 selectCount 方法统计考试记录数量
return this.selectCount(wrapper);
}
// 新增方法:统计指定考试科目的考试记录数量
public int countExamRecordsBySubject(String subject) {
// 创建一个查询条件包装器
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<>();
// 添加考试科目等于指定科目的查询条件
wrapper.eq("subject", subject);
// 调用基础映射器的 selectCount 方法统计考试记录数量
return this.selectCount(wrapper);
}
// 新增方法:统计指定学生 ID 的考试记录数量
public int countExamRecordsByStudentId(int studentId) {
// 创建一个查询条件包装器
Wrapper<ExamrecordEntity> wrapper = new EntityWrapper<>();
// 添加学生 ID 等于指定 ID 的查询条件
wrapper.eq("student_id", studentId);
// 调用基础映射器的 selectCount 方法统计考试记录数量
return this.selectCount(wrapper);
}
// 新增方法:获取指定日期范围内的最高考试成绩
public Optional<Integer> getMaxScoreByDateRange(Date startDate, Date endDate) {
// 根据日期范围查询考试记录视图列表
List<ExamrecordView> records = selectListViewByDateRange(startDate, endDate);
if (records.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int maxScore = Integer.MIN_VALUE;
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
if (record.getScore() > maxScore) {
// 更新最高成绩
maxScore = record.getScore();
}
}
// 返回包含最高成绩的 Optional 对象
return Optional.of(maxScore);
}
// 新增方法:获取指定日期范围内的最低考试成绩
public Optional<Integer> getMinScoreByDateRange(Date startDate, Date endDate) {
// 根据日期范围查询考试记录视图列表
List<ExamrecordView> records = selectListViewByDateRange(startDate, endDate);
if (records.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int minScore = Integer.MAX_VALUE;
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
if (record.getScore() < minScore) {
// 更新最低成绩
minScore = record.getScore();
}
}
// 返回包含最低成绩的 Optional 对象
return Optional.of(minScore);
}
// 新增方法:获取指定考试科目的最高考试成绩
public Optional<Integer> getMaxScoreBySubject(String subject) {
// 根据考试科目查询考试记录视图列表
List<ExamrecordView> records = selectListViewBySubject(subject);
if (records.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int maxScore = Integer.MIN_VALUE;
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
if (record.getScore() > maxScore) {
// 更新最高成绩
maxScore = record.getScore();
}
}
// 返回包含最高成绩的 Optional 对象
return Optional.of(maxScore);
}
// 新增方法:获取指定考试科目的最低考试成绩
public Optional<Integer> getMinScoreBySubject(String subject) {
// 根据考试科目查询考试记录视图列表
List<ExamrecordView> records = selectListViewBySubject(subject);
if (records.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int minScore = Integer.MAX_VALUE;
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
if (record.getScore() < minScore) {
// 更新最低成绩
minScore = record.getScore();
}
}
// 返回包含最低成绩的 Optional 对象
return Optional.of(minScore);
}
// 新增方法:获取指定学生 ID 的最高考试成绩
public Optional<Integer> getMaxScoreByStudentId(int studentId) {
// 根据学生 ID 查询考试记录视图列表
List<ExamrecordView> records = selectListViewByStudentId(studentId);
if (records.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int maxScore = Integer.MIN_VALUE;
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
if (record.getScore() > maxScore) {
// 更新最高成绩
maxScore = record.getScore();
}
}
// 返回包含最高成绩的 Optional 对象
return Optional.of(maxScore);
}
// 新增方法:获取指定学生 ID 的最低考试成绩
public Optional<Integer> getMinScoreByStudentId(int studentId) {
// 根据学生 ID 查询考试记录视图列表
List<ExamrecordView> records = selectListViewByStudentId(studentId);
if (records.isEmpty()) {
// 如果列表为空,返回空的 Optional 对象
return Optional.empty();
}
int minScore = Integer.MAX_VALUE;
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
if (record.getScore() < minScore) {
// 更新最低成绩
minScore = record.getScore();
}
}
// 返回包含最低成绩的 Optional 对象
return Optional.of(minScore);
}
// 新增方法:根据考试日期对考试记录视图列表进行排序
public List<ExamrecordView> sortExamRecordsByExamDate(List<ExamrecordView> records) {
// 使用 Collections.sort 方法对列表进行排序
Collections.sort(records, Comparator.comparing(ExamrecordView::getExamDate));
return records;
}
// 新增方法:根据考试成绩对考试记录视图列表进行排序
public List<ExamrecordView> sortExamRecordsByScore(List<ExamrecordView> records) {
// 使用 Collections.sort 方法对列表进行排序
Collections.sort(records, Comparator.comparing(ExamrecordView::getScore));
return records;
}
// 新增方法:获取指定日期范围内的考试记录按考试科目分组统计数量
public Map<String, Integer> countExamRecordsBySubjectInDateRange(Date startDate, Date endDate) {
// 根据日期范围查询考试记录视图列表
List<ExamrecordView> records = selectListViewByDateRange(startDate, endDate);
// 创建一个 HashMap 用于存储统计结果
Map<String, Integer> subjectCountMap = new HashMap<>();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
String subject = record.getSubject();
// 如果该科目已经在 Map 中,增加其计数
subjectCountMap.put(subject, subjectCountMap.getOrDefault(subject, 0) + 1);
}
return subjectCountMap;
}
// 新增方法:获取指定学生 ID 的考试记录按考试科目分组统计数量
public Map<String, Integer> countExamRecordsBySubjectForStudent(int studentId) {
// 根据学生 ID 查询考试记录视图列表
List<ExamrecordView> records = selectListViewByStudentId(studentId);
// 创建一个 HashMap 用于存储统计结果
Map<String, Integer> subjectCountMap = new HashMap<>();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
String subject = record.getSubject();
// 如果该科目已经在 Map 中,增加其计数
subjectCountMap.put(subject, subjectCountMap.getOrDefault(subject, 0) + 1);
}
return subjectCountMap;
}
// 新增方法:获取指定日期范围内的考试记录按学生 ID 分组统计数量
public Map<Integer, Integer> countExamRecordsByStudentIdInDateRange(Date startDate, Date endDate) {
// 根据日期范围查询考试记录视图列表
List<ExamrecordView> records = selectListViewByDateRange(startDate, endDate);
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Integer> studentCountMap = new HashMap<>();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
int studentId = record.getStudentId();
// 如果该学生 ID 已经在 Map 中,增加其计数
studentCountMap.put(studentId, studentCountMap.getOrDefault(studentId, 0) + 1);
}
return studentCountMap;
}
// 新增方法:获取指定考试科目的考试记录按学生 ID 分组统计数量
public Map<Integer, Integer> countExamRecordsByStudentIdForSubject(String subject) {
// 根据考试科目查询考试记录视图列表
List<ExamrecordView> records = selectListViewBySubject(subject);
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Integer> studentCountMap = new HashMap<>();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
int studentId = record.getStudentId();
// 如果该学生 ID 已经在 Map 中,增加其计数
studentCountMap.put(studentId, studentCountMap.getOrDefault(studentId, 0) + 1);
}
return studentCountMap;
}
// 新增方法:获取指定日期范围内的考试记录按考试成绩区间分组统计数量
public Map<String, Integer> countExamRecordsByScoreRangeInDateRange(Date startDate, Date endDate, int interval) {
// 根据日期范围查询考试记录视图列表
List<ExamrecordView> records = selectListViewByDateRange(startDate, endDate);
// 创建一个 HashMap 用于存储统计结果
Map<String, Integer> scoreRangeCountMap = new HashMap<>();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
int score = record.getScore();
int lowerBound = (score / interval) * interval;
int upperBound = lowerBound + interval;
String range = lowerBound + "-" + upperBound;
// 如果该成绩区间已经在 Map 中,增加其计数
scoreRangeCountMap.put(range, scoreRangeCountMap.getOrDefault(range, 0) + 1);
}
return scoreRangeCountMap;
}
// 新增方法:获取指定学生 ID 的考试记录按考试成绩区间分组统计数量
public Map<String, Integer> countExamRecordsByScoreRangeForStudent(int studentId, int interval) {
// 根据学生 ID 查询考试记录视图列表
List<ExamrecordView> records = selectListViewByStudentId(studentId);
// 创建一个 HashMap 用于存储统计结果
Map<String, Integer> scoreRangeCountMap = new HashMap<>();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
int score = record.getScore();
int lowerBound = (score / interval) * interval;
int upperBound = lowerBound + interval;
String range = lowerBound + "-" + upperBound;
// 如果该成绩区间已经在 Map 中,增加其计数
scoreRangeCountMap.put(range, scoreRangeCountMap.getOrDefault(range, 0) + 1);
}
return scoreRangeCountMap;
}
// 新增方法:获取指定考试科目的考试记录按考试成绩区间分组统计数量
public Map<String, Integer> countExamRecordsByScoreRangeForSubject(String subject, int interval) {
// 根据考试科目查询考试记录视图列表
List<ExamrecordView> records = selectListViewBySubject(subject);
// 创建一个 HashMap 用于存储统计结果
Map<String, Integer> scoreRangeCountMap = new HashMap<>();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
int score = record.getScore();
int lowerBound = (score / interval) * interval;
int upperBound = lowerBound + interval;
String range = lowerBound + "-" + upperBound;
// 如果该成绩区间已经在 Map 中,增加其计数
scoreRangeCountMap.put(range, scoreRangeCountMap.getOrDefault(range, 0) + 1);
}
return scoreRangeCountMap;
}
// 新增方法:获取指定日期范围内的考试记录按月份分组统计数量
public Map<Integer, Integer> countExamRecordsByMonthInDateRange(Date startDate, Date endDate) {
// 根据日期范围查询考试记录视图列表
List<ExamrecordView> records = selectListViewByDateRange(startDate, endDate);
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Integer> monthCountMap = new HashMap<>();
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
calendar.setTime(record.getExamDate());
int month = calendar.get(Calendar.MONTH) + 1;
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return monthCountMap;
}
// 新增方法:获取指定学生 ID 的考试记录按月份分组统计数量
public Map<Integer, Integer> countExamRecordsByMonthForStudent(int studentId) {
// 根据学生 ID 查询考试记录视图列表
List<ExamrecordView> records = selectListViewByStudentId(studentId);
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Integer> monthCountMap = new HashMap<>();
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
calendar.setTime(record.getExamDate());
int month = calendar.get(Calendar.MONTH) + 1;
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return monthCountMap;
}
// 新增方法:获取指定考试科目的考试记录按月份分组统计数量
public Map<Integer, Integer> countExamRecordsByMonthForSubject(String subject) {
// 根据考试科目查询考试记录视图列表
List<ExamrecordView> records = selectListViewBySubject(subject);
// 创建一个 HashMap 用于存储统计结果
Map<Integer, Integer> monthCountMap = new HashMap<>();
// 创建一个 Calendar 实例
Calendar calendar = Calendar.getInstance();
// 遍历考试记录视图列表
for (ExamrecordView record : records) {
calendar.setTime(record.getExamDate());
int month = calendar.get(Calendar.MONTH) + 1;
// 如果该月份已经在 Map 中,增加其计数
monthCountMap.put(month, monthCountMap.getOrDefault(month, 0) + 1);
}
return monthCountMap;
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入论坛数据访问对象
import com.dao.ForumDao;
// 导入论坛实体类
import com.entity.ForumEntity;
// 导入论坛服务接口
import com.service.ForumService;
// 导入论坛值对象类
import com.entity.vo.ForumVO;
// 导入论坛视图类
import com.entity.view.ForumView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 forumService
@Service("forumService")
// 定义论坛服务实现类,继承自 ServiceImpl 并实现 ForumService 接口
public class ForumServiceImpl extends ServiceImpl<ForumDao, ForumEntity> implements ForumService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<ForumEntity> page = this.selectPage(
new Query<ForumEntity>(params).getPage(),
new EntityWrapper<ForumEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询论坛实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成
Page<ForumEntity> page = this.selectPage(
new Query<ForumEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<ForumEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询论坛视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ForumEntity> wrapper) {
Page<ForumView> page =new Query<ForumView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成,用于存储论坛视图数据
Page<ForumView> page = new Query<ForumView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取论坛视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询论坛值对象列表
@Override
public List<ForumVO> selectListVO(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个论坛值对象
@Override
public ForumVO selectVO(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询论坛视图列表
@Override
public List<ForumView> selectListView(Wrapper<ForumEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个论坛视图
@Override
public ForumView selectView(Wrapper<ForumEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入购买的课程数据访问对象
import com.dao.GoumaidekechengDao;
// 导入购买的课程实体类
import com.entity.GoumaidekechengEntity;
// 导入购买的课程服务接口
import com.service.GoumaidekechengService;
// 导入购买的课程值对象类
import com.entity.vo.GoumaidekechengVO;
// 导入购买的课程视图类
import com.entity.view.GoumaidekechengView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 goumaidekechengService
@Service("goumaidekechengService")
// 定义购买的课程服务实现类,继承自 ServiceImpl 并实现 GoumaidekechengService 接口
public class GoumaidekechengServiceImpl extends ServiceImpl<GoumaidekechengDao, GoumaidekechengEntity> implements GoumaidekechengService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<GoumaidekechengEntity> page = this.selectPage(
new Query<GoumaidekechengEntity>(params).getPage(),
new EntityWrapper<GoumaidekechengEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询购买的课程实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数生成
Page<GoumaidekechengEntity> page = this.selectPage(
new Query<GoumaidekechengEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<GoumaidekechengEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询购买的课程视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<GoumaidekechengEntity> wrapper) {
Page<GoumaidekechengView> page =new Query<GoumaidekechengView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数生成,用于存储购买的课程视图数据
Page<GoumaidekechengView> page = new Query<GoumaidekechengView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取购买的课程视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询购买的课程值对象列表
@Override
public List<GoumaidekechengVO> selectListVO(Wrapper<GoumaidekechengEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个购买的课程值对象
@Override
public GoumaidekechengVO selectVO(Wrapper<GoumaidekechengEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询购买的课程视图列表
@Override
public List<GoumaidekechengView> selectListView(Wrapper<GoumaidekechengEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个购买的课程视图
@Override
public GoumaidekechengView selectView(Wrapper<GoumaidekechengEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所属的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入课程类型数据访问对象
import com.dao.KechengleixingDao;
// 导入课程类型实体类
import com.entity.KechengleixingEntity;
// 导入课程类型服务接口
import com.service.KechengleixingService;
// 导入课程类型值对象类
import com.entity.vo.KechengleixingVO;
// 导入课程类型视图类
import com.entity.view.KechengleixingView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 kechengleixingService
@Service("kechengleixingService")
// 定义课程类型服务实现类,继承自 ServiceImpl 并实现 KechengleixingService 接口
public class KechengleixingServiceImpl extends ServiceImpl<KechengleixingDao, KechengleixingEntity> implements KechengleixingService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<KechengleixingEntity> page = this.selectPage(
new Query<KechengleixingEntity>(params).getPage(),
new EntityWrapper<KechengleixingEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询课程类型实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成
Page<KechengleixingEntity> page = this.selectPage(
new Query<KechengleixingEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<KechengleixingEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询课程类型视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<KechengleixingEntity> wrapper) {
Page<KechengleixingView> page =new Query<KechengleixingView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成,用于存储课程类型视图数据
Page<KechengleixingView> page = new Query<KechengleixingView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取课程类型视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询课程类型值对象列表
@Override
public List<KechengleixingVO> selectListVO(Wrapper<KechengleixingEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个课程类型值对象
@Override
public KechengleixingVO selectVO(Wrapper<KechengleixingEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询课程类型视图列表
@Override
public List<KechengleixingView> selectListView(Wrapper<KechengleixingEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个课程类型视图
@Override
public KechengleixingView selectView(Wrapper<KechengleixingEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入课程信息数据访问对象
import com.dao.KechengxinxiDao;
// 导入课程信息实体类
import com.entity.KechengxinxiEntity;
// 导入课程信息服务接口
import com.service.KechengxinxiService;
// 导入课程信息值对象类
import com.entity.vo.KechengxinxiVO;
// 导入课程信息视图类
import com.entity.view.KechengxinxiView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 kechengxinxiService
@Service("kechengxinxiService")
// 定义课程信息服务实现类,继承自 ServiceImpl 并实现 KechengxinxiService 接口
public class KechengxinxiServiceImpl extends ServiceImpl<KechengxinxiDao, KechengxinxiEntity> implements KechengxinxiService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<KechengxinxiEntity> page = this.selectPage(
new Query<KechengxinxiEntity>(params).getPage(),
new EntityWrapper<KechengxinxiEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询课程信息实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数生成
Page<KechengxinxiEntity> page = this.selectPage(
new Query<KechengxinxiEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<KechengxinxiEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询课程信息视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<KechengxinxiEntity> wrapper) {
Page<KechengxinxiView> page =new Query<KechengxinxiView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数生成,用于存储课程信息视图数据
Page<KechengxinxiView> page = new Query<KechengxinxiView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取课程信息视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询课程信息值对象列表
@Override
public List<KechengxinxiVO> selectListVO(Wrapper<KechengxinxiEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个课程信息值对象
@Override
public KechengxinxiVO selectVO(Wrapper<KechengxinxiEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询课程信息视图列表
@Override
public List<KechengxinxiView> selectListView(Wrapper<KechengxinxiEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个课程信息视图
@Override
public KechengxinxiView selectView(Wrapper<KechengxinxiEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所属的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于标记该类为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入消息数据访问对象
import com.dao.MessagesDao;
// 导入消息实体类
import com.entity.MessagesEntity;
// 导入消息服务接口
import com.service.MessagesService;
// 导入消息值对象类
import com.entity.vo.MessagesVO;
// 导入消息视图类
import com.entity.view.MessagesView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 messagesService
@Service("messagesService")
// 定义消息服务实现类,继承自 ServiceImpl 并实现 MessagesService 接口
public class MessagesServiceImpl extends ServiceImpl<MessagesDao, MessagesEntity> implements MessagesService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<MessagesEntity> page = this.selectPage(
new Query<MessagesEntity>(params).getPage(),
new EntityWrapper<MessagesEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询消息实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数生成
Page<MessagesEntity> page = this.selectPage(
new Query<MessagesEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<MessagesEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询消息视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<MessagesEntity> wrapper) {
Page<MessagesView> page =new Query<MessagesView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数生成,用于存储消息视图数据
Page<MessagesView> page = new Query<MessagesView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取消息视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询消息值对象列表
@Override
public List<MessagesVO> selectListVO(Wrapper<MessagesEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个消息值对象
@Override
public MessagesVO selectVO(Wrapper<MessagesEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询消息视图列表
@Override
public List<MessagesView> selectListView(Wrapper<MessagesEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个消息视图
@Override
public MessagesView selectView(Wrapper<MessagesEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入新闻数据访问对象
import com.dao.NewsDao;
// 导入新闻实体类
import com.entity.NewsEntity;
// 导入新闻服务接口
import com.service.NewsService;
// 导入新闻值对象类
import com.entity.vo.NewsVO;
// 导入新闻视图类
import com.entity.view.NewsView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 newsService
@Service("newsService")
// 定义新闻服务实现类,继承自 ServiceImpl 并实现 NewsService 接口
public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements NewsService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<NewsEntity> page = this.selectPage(
new Query<NewsEntity>(params).getPage(),
new EntityWrapper<NewsEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询新闻实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数生成
Page<NewsEntity> page = this.selectPage(
new Query<NewsEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<NewsEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询新闻视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<NewsEntity> wrapper) {
Page<NewsView> page =new Query<NewsView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数生成,用于存储新闻视图数据
Page<NewsView> page = new Query<NewsView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取新闻视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询新闻值对象列表
@Override
public List<NewsVO> selectListVO(Wrapper<NewsEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个新闻值对象
@Override
public NewsVO selectVO(Wrapper<NewsEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询新闻视图列表
@Override
public List<NewsView> selectListView(Wrapper<NewsEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个新闻视图
@Override
public NewsView selectView(Wrapper<NewsEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入视频点播数据访问对象
import com.dao.ShipindianboDao;
// 导入视频点播实体类
import com.entity.ShipindianboEntity;
// 导入视频点播服务接口
import com.service.ShipindianboService;
// 导入视频点播值对象类
import com.entity.vo.ShipindianboVO;
// 导入视频点播视图类
import com.entity.view.ShipindianboView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 shipindianboService
@Service("shipindianboService")
// 定义视频点播服务实现类,继承自 ServiceImpl 并实现 ShipindianboService 接口
public class ShipindianboServiceImpl extends ServiceImpl<ShipindianboDao, ShipindianboEntity> implements ShipindianboService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<ShipindianboEntity> page = this.selectPage(
new Query<ShipindianboEntity>(params).getPage(),
new EntityWrapper<ShipindianboEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询视频点播实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数生成
Page<ShipindianboEntity> page = this.selectPage(
new Query<ShipindianboEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<ShipindianboEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询视频点播视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ShipindianboEntity> wrapper) {
Page<ShipindianboView> page =new Query<ShipindianboView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数生成,用于存储视频点播视图数据
Page<ShipindianboView> page = new Query<ShipindianboView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取视频点播视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询视频点播值对象列表
@Override
public List<ShipindianboVO> selectListVO(Wrapper<ShipindianboEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个视频点播值对象
@Override
public ShipindianboVO selectVO(Wrapper<ShipindianboEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询视频点播视图列表
@Override
public List<ShipindianboView> selectListView(Wrapper<ShipindianboEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个视频点播视图
@Override
public ShipindianboView selectView(Wrapper<ShipindianboEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入收藏数据访问对象
import com.dao.StoreupDao;
// 导入收藏实体类
import com.entity.StoreupEntity;
// 导入收藏服务接口
import com.service.StoreupService;
// 导入收藏值对象类
import com.entity.vo.StoreupVO;
// 导入收藏视图类
import com.entity.view.StoreupView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 storeupService
@Service("storeupService")
// 定义收藏服务实现类,继承自 ServiceImpl 并实现 StoreupService 接口
public class StoreupServiceImpl extends ServiceImpl<StoreupDao, StoreupEntity> implements StoreupService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<StoreupEntity> page = this.selectPage(
new Query<StoreupEntity>(params).getPage(),
new EntityWrapper<StoreupEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询收藏实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数生成
Page<StoreupEntity> page = this.selectPage(
new Query<StoreupEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<StoreupEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询收藏视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<StoreupEntity> wrapper) {
Page<StoreupView> page =new Query<StoreupView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数生成,用于存储收藏视图数据
Page<StoreupView> page = new Query<StoreupView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取收藏视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询收藏值对象列表
@Override
public List<StoreupVO> selectListVO(Wrapper<StoreupEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个收藏值对象
@Override
public StoreupVO selectVO(Wrapper<StoreupEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询收藏视图列表
@Override
public List<StoreupView> selectListView(Wrapper<StoreupEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个收藏视图
@Override
public StoreupView selectView(Wrapper<StoreupEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,79 +1,121 @@
// 声明该类所在的包为com.service.impl
package com.service.impl;
// 导入Java的Calendar类用于处理日期和时间
import java.util.Calendar;
// 导入Java的Date类用于表示日期和时间
import java.util.Date;
// 导入Java的List接口用于处理列表数据
import java.util.List;
// 导入Java的Map接口用于处理键值对数据
import java.util.Map;
// 导入Spring框架的Service注解用于标记该类为服务层组件
import org.springframework.stereotype.Service;
// 导入MyBatis-Plus的EntityWrapper类用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的Wrapper接口用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入MyBatis-Plus的Page类用于分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入MyBatis-Plus的ServiceImpl类提供通用的服务层实现
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入数据访问对象TokenDao
import com.dao.TokenDao;
// 导入Token实体类
import com.entity.TokenEntity;
// 重复导入Token实体类可考虑移除一个
import com.entity.TokenEntity;
// 导入Token服务接口
import com.service.TokenService;
// 导入自定义的通用工具类
import com.utils.CommonUtil;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
/**
* token
*/
// token服务实现类
// 标记该类为Spring的服务组件名称为tokenService
@Service("tokenService")
// 定义TokenServiceImpl类继承ServiceImpl类并实现TokenService接口
public class TokenServiceImpl extends ServiceImpl<TokenDao, TokenEntity> implements TokenService {
// 重写queryPage方法用于根据参数查询Token实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数进行初始化
Page<TokenEntity> page = this.selectPage(
new Query<TokenEntity>(params).getPage(),
new EntityWrapper<TokenEntity>()
);
return new PageUtils(page);
new Query<TokenEntity>(params).getPage(),
// 创建一个查询条件包装器
new EntityWrapper<TokenEntity>()
);
// 返回分页工具类对象,包含分页信息
return new PageUtils(page);
}
// 重写selectListView方法用于根据查询条件查询Token实体的列表数据
@Override
public List<TokenEntity> selectListView(Wrapper<TokenEntity> wrapper) {
// 调用基础映射器的selectListView方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写queryPage方法用于根据参数和查询条件查询Token实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params,
Wrapper<TokenEntity> wrapper) {
Page<TokenEntity> page =new Query<TokenEntity>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
Wrapper<TokenEntity> wrapper) {
// 创建一个分页对象,根据传入的参数进行初始化
Page<TokenEntity> page = new Query<TokenEntity>(params).getPage();
// 设置分页对象的记录列表通过基础映射器的selectListView方法查询
page.setRecords(baseMapper.selectListView(page, wrapper));
// 创建分页工具类对象,包含分页信息
PageUtils pageUtil = new PageUtils(page);
// 返回分页工具类对象
return pageUtil;
}
// 重写generateToken方法用于生成Token
@Override
public String generateToken(Long userid,String username, String tableName, String role) {
public String generateToken(Long userid, String username, String tableName, String role) {
// 根据用户ID和角色查询Token实体
TokenEntity tokenEntity = this.selectOne(new EntityWrapper<TokenEntity>().eq("userid", userid).eq("role", role));
// 生成一个32位的随机字符串作为Token
String token = CommonUtil.getRandomString(32);
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.HOUR_OF_DAY, 1);
if(tokenEntity!=null) {
// 获取当前的Calendar实例
Calendar cal = Calendar.getInstance();
// 设置Calendar的时间为当前时间
cal.setTime(new Date());
// 将Calendar的时间增加1小时
cal.add(Calendar.HOUR_OF_DAY, 1);
// 如果Token实体存在
if (tokenEntity != null) {
// 设置Token实体的Token值
tokenEntity.setToken(token);
// 设置Token实体的过期时间
tokenEntity.setExpiratedtime(cal.getTime());
// 更新Token实体
this.updateById(tokenEntity);
} else {
this.insert(new TokenEntity(userid,username, tableName, role, token, cal.getTime()));
// 如果Token实体不存在插入一个新的Token实体
this.insert(new TokenEntity(userid, username, tableName, role, token, cal.getTime()));
}
// 返回生成的Token
return token;
}
// 重写getTokenEntity方法用于根据Token获取Token实体
@Override
public TokenEntity getTokenEntity(String token) {
// 根据Token查询Token实体
TokenEntity tokenEntity = this.selectOne(new EntityWrapper<TokenEntity>().eq("token", token));
if(tokenEntity == null || tokenEntity.getExpiratedtime().getTime()<new Date().getTime()) {
// 如果Token实体为空或者Token已过期
if (tokenEntity == null || tokenEntity.getExpiratedtime().getTime() < new Date().getTime()) {
// 返回null
return null;
}
// 返回Token实体
return tokenEntity;
}
}
}

@ -1,49 +1,70 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Spring 框架的 Service 注解,用于标记该类为服务层组件
import org.springframework.stereotype.Service;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 Page 类,用于分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,提供通用的服务层实现
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入 User 数据访问对象
import com.dao.UserDao;
// 导入 User 实体类
import com.entity.UserEntity;
// 导入 User 服务接口
import com.service.UserService;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
/**
*
*/
// 系统用户服务实现类
// 标记该类为 Spring 的服务组件,名称为 userService
@Service("userService")
// 定义 UserServiceImpl 类继承ServiceImpl类并实现 UserService 接口
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {
// 重写 queryPage 方法,用于根据参数查询 User 实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数进行初始化
Page<UserEntity> page = this.selectPage(
new Query<UserEntity>(params).getPage(),
new EntityWrapper<UserEntity>()
);
return new PageUtils(page);
new Query<UserEntity>(params).getPage(),
// 创建一个查询条件包装器
new EntityWrapper<UserEntity>()
);
// 返回分页工具类对象,包含分页信息
return new PageUtils(page);
}
// 重写 selectListView 方法,用于根据查询条件查询 User 实体的列表数据
@Override
public List<UserEntity> selectListView(Wrapper<UserEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 queryPage 方法,用于根据参数和查询条件查询 User 实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params,
Wrapper<UserEntity> wrapper) {
Page<UserEntity> page =new Query<UserEntity>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
Wrapper<UserEntity> wrapper) {
// 创建一个分页对象,根据传入的参数进行初始化
Page<UserEntity> page = new Query<UserEntity>(params).getPage();
// 设置分页对象的记录列表,通过基础映射器的 selectListView 方法查询
page.setRecords(baseMapper.selectListView(page, wrapper));
// 创建分页工具类对象,包含分页信息
PageUtils pageUtil = new PageUtils(page);
// 返回分页工具类对象
return pageUtil;
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入我的笔记数据访问对象
import com.dao.WodebijiDao;
// 导入我的笔记实体类
import com.entity.WodebijiEntity;
// 导入我的笔记服务接口
import com.service.WodebijiService;
// 导入我的笔记值对象类
import com.entity.vo.WodebijiVO;
// 导入我的笔记视图类
import com.entity.view.WodebijiView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 wodebijiService
@Service("wodebijiService")
// 定义我的笔记服务实现类,继承自 ServiceImpl 并实现 WodebijiService 接口
public class WodebijiServiceImpl extends ServiceImpl<WodebijiDao, WodebijiEntity> implements WodebijiService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<WodebijiEntity> page = this.selectPage(
new Query<WodebijiEntity>(params).getPage(),
new EntityWrapper<WodebijiEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,用于根据传入的参数查询我的笔记实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成
Page<WodebijiEntity> page = this.selectPage(
new Query<WodebijiEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<WodebijiEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,用于根据传入的参数和查询条件查询我的笔记视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<WodebijiEntity> wrapper) {
Page<WodebijiView> page =new Query<WodebijiView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成,用于存储我的笔记视图数据
Page<WodebijiView> page = new Query<WodebijiView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取我的笔记视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,用于根据查询条件查询我的笔记值对象列表
@Override
public List<WodebijiVO> selectListVO(Wrapper<WodebijiEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,用于根据查询条件查询单个我的笔记值对象
@Override
public WodebijiVO selectVO(Wrapper<WodebijiEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,用于根据查询条件查询我的笔记视图列表
@Override
public List<WodebijiView> selectListView(Wrapper<WodebijiEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,用于根据查询条件查询单个我的笔记视图
@Override
public WodebijiView selectView(Wrapper<WodebijiEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入我的课程数据访问对象
import com.dao.WodekechengDao;
// 导入我的课程实体类
import com.entity.WodekechengEntity;
// 导入我的课程服务接口
import com.service.WodekechengService;
// 导入我的课程值对象类
import com.entity.vo.WodekechengVO;
// 导入我的课程视图类
import com.entity.view.WodekechengView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 wodekechengService
@Service("wodekechengService")
// 定义我的课程服务实现类,继承自 ServiceImpl 并实现 WodekechengService 接口
public class WodekechengServiceImpl extends ServiceImpl<WodekechengDao, WodekechengEntity> implements WodekechengService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<WodekechengEntity> page = this.selectPage(
new Query<WodekechengEntity>(params).getPage(),
new EntityWrapper<WodekechengEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询我的课程实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数生成
Page<WodekechengEntity> page = this.selectPage(
new Query<WodekechengEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<WodekechengEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询我的课程视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<WodekechengEntity> wrapper) {
Page<WodekechengView> page =new Query<WodekechengView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数生成,用于存储我的课程视图数据
Page<WodekechengView> page = new Query<WodekechengView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取我的课程视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询我的课程值对象列表
@Override
public List<WodekechengVO> selectListVO(Wrapper<WodekechengEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个我的课程值对象
@Override
public WodekechengVO selectVO(Wrapper<WodekechengEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询我的课程视图列表
@Override
public List<WodekechengView> selectListView(Wrapper<WodekechengEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个我的课程视图
@Override
public WodekechengView selectView(Wrapper<WodekechengEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入消息通知数据访问对象
import com.dao.XiaoxitongzhiDao;
// 导入消息通知实体类
import com.entity.XiaoxitongzhiEntity;
// 导入消息通知服务接口
import com.service.XiaoxitongzhiService;
// 导入消息通知值对象类
import com.entity.vo.XiaoxitongzhiVO;
// 导入消息通知视图类
import com.entity.view.XiaoxitongzhiView;
// 使用 @Service 注解将该类标记为 Spring 服务,服务名为 xiaoxitongzhiService
@Service("xiaoxitongzhiService")
// 定义消息通知服务实现类,继承 ServiceImpl 并实现 XiaoxitongzhiService 接口
public class XiaoxitongzhiServiceImpl extends ServiceImpl<XiaoxitongzhiDao, XiaoxitongzhiEntity> implements XiaoxitongzhiService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<XiaoxitongzhiEntity> page = this.selectPage(
new Query<XiaoxitongzhiEntity>(params).getPage(),
new EntityWrapper<XiaoxitongzhiEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数查询消息通知实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数生成
Page<XiaoxitongzhiEntity> page = this.selectPage(
new Query<XiaoxitongzhiEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<XiaoxitongzhiEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件查询消息通知视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<XiaoxitongzhiEntity> wrapper) {
Page<XiaoxitongzhiView> page =new Query<XiaoxitongzhiView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数生成,用于存储消息通知视图数据
Page<XiaoxitongzhiView> page = new Query<XiaoxitongzhiView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取消息通知视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询消息通知值对象列表
@Override
public List<XiaoxitongzhiVO> selectListVO(Wrapper<XiaoxitongzhiEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个消息通知值对象
@Override
public XiaoxitongzhiVO selectVO(Wrapper<XiaoxitongzhiEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询消息通知视图列表
@Override
public List<XiaoxitongzhiView> selectListView(Wrapper<XiaoxitongzhiEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个消息通知视图
@Override
public XiaoxitongzhiView selectView(Wrapper<XiaoxitongzhiEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所属的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入学科数据访问对象
import com.dao.XuekeDao;
// 导入学科实体类
import com.entity.XuekeEntity;
// 导入学科服务接口
import com.service.XuekeService;
// 导入学科值对象类
import com.entity.vo.XuekeVO;
// 导入学科视图类
import com.entity.view.XuekeView;
// 使用 @Service 注解,将该类注册为 Spring 服务,服务名为 xuekeService
@Service("xuekeService")
// 定义学科服务实现类,继承自 ServiceImpl 并实现 XuekeService 接口
public class XuekeServiceImpl extends ServiceImpl<XuekeDao, XuekeEntity> implements XuekeService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<XuekeEntity> page = this.selectPage(
new Query<XuekeEntity>(params).getPage(),
new EntityWrapper<XuekeEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据参数查询学科实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成
Page<XuekeEntity> page = this.selectPage(
new Query<XuekeEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<XuekeEntity>()
);
// 返回分页工具类对象,封装分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据参数和查询条件查询学科视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<XuekeEntity> wrapper) {
Page<XuekeView> page =new Query<XuekeView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,通过 Query 工具类根据传入的参数生成,用于存储学科视图数据
Page<XuekeView> page = new Query<XuekeView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取学科视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类对象,封装分页信息
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询学科值对象列表
@Override
public List<XuekeVO> selectListVO(Wrapper<XuekeEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个学科值对象
@Override
public XuekeVO selectVO(Wrapper<XuekeEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询学科视图列表
@Override
public List<XuekeView> selectListView(Wrapper<XuekeEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个学科视图
@Override
public XuekeView selectView(Wrapper<XuekeEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,92 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 @Service 注解,用于将该类标记为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 中的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 中的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于实现分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,作为服务实现类的基类
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入用户数据访问对象
import com.dao.YonghuDao;
// 导入用户实体类
import com.entity.YonghuEntity;
// 导入用户服务接口
import com.service.YonghuService;
// 导入用户值对象类
import com.entity.vo.YonghuVO;
// 导入用户视图类
import com.entity.view.YonghuView;
// 使用 @Service 注解,将该类注册为 Spring 服务,服务名为 yonghuService
@Service("yonghuService")
// 定义 YonghuServiceImpl 类,继承自 MyBatis-Plus 的 ServiceImpl 类,并实现 YonghuService 接口
public class YonghuServiceImpl extends ServiceImpl<YonghuDao, YonghuEntity> implements YonghuService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<YonghuEntity> page = this.selectPage(
new Query<YonghuEntity>(params).getPage(),
new EntityWrapper<YonghuEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据传入的参数进行分页查询用户实体数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,通过 Query 工具类根据参数生成
Page<YonghuEntity> page = this.selectPage(
new Query<YonghuEntity>(params).getPage(),
// 创建一个空的查询条件包装器
new EntityWrapper<YonghuEntity>()
);
// 将分页对象封装到 PageUtils 工具类中并返回
return new PageUtils(page);
}
// 重写 queryPage 方法,根据传入的参数和查询条件进行分页查询用户视图数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<YonghuEntity> wrapper) {
Page<YonghuView> page =new Query<YonghuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,通过 Query 工具类根据参数生成,用于存储用户视图数据
Page<YonghuView> page = new Query<YonghuView>(params).getPage();
// 调用基础映射器的 selectListView 方法,根据分页和查询条件获取用户视图列表,并设置到分页对象中
page.setRecords(baseMapper.selectListView(page, wrapper));
// 将分页对象封装到 PageUtils 工具类中并返回
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询用户值对象列表
@Override
public List<YonghuVO> selectListVO(Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个用户值对象
@Override
public YonghuVO selectVO(Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询用户视图列表
@Override
public List<YonghuView> selectListView(Wrapper<YonghuEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个用户视图
@Override
public YonghuView selectView(Wrapper<YonghuEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}

@ -1,62 +1,93 @@
// 声明该类所在的包为 com.service.impl
package com.service.impl;
// 导入 Spring 框架的 Service 注解,用于标记该类为服务层组件
import org.springframework.stereotype.Service;
// 导入 Java 的 Map 接口,用于处理键值对数据
import java.util.Map;
// 导入 Java 的 List 接口,用于处理列表数据
import java.util.List;
// 导入 MyBatis-Plus 的 Wrapper 接口,用于封装查询条件
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入 MyBatis-Plus 的 EntityWrapper 类,用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的 Page 类,用于分页查询
import com.baomidou.mybatisplus.plugins.Page;
// 导入 MyBatis-Plus 的 ServiceImpl 类,提供通用的服务层实现
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的查询工具类
import com.utils.Query;
// 导入职业规划数据访问对象
import com.dao.ZhiyeguihuaDao;
// 导入职业规划实体类
import com.entity.ZhiyeguihuaEntity;
// 导入职业规划服务接口
import com.service.ZhiyeguihuaService;
// 导入职业规划值对象类
import com.entity.vo.ZhiyeguihuaVO;
// 导入职业规划视图类
import com.entity.view.ZhiyeguihuaView;
// 使用 @Service 注解标记该类为服务层组件,名称为 zhiyeguihuaService
@Service("zhiyeguihuaService")
// 定义 ZhiyeguihuaServiceImpl 类,继承 ServiceImpl 类并实现 ZhiyeguihuaService 接口
public class ZhiyeguihuaServiceImpl extends ServiceImpl<ZhiyeguihuaDao, ZhiyeguihuaEntity> implements ZhiyeguihuaService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<ZhiyeguihuaEntity> page = this.selectPage(
new Query<ZhiyeguihuaEntity>(params).getPage(),
new EntityWrapper<ZhiyeguihuaEntity>()
);
return new PageUtils(page);
}
@Override
// 重写 queryPage 方法,根据参数查询职业规划实体的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,根据传入的参数进行初始化
Page<ZhiyeguihuaEntity> page = this.selectPage(
new Query<ZhiyeguihuaEntity>(params).getPage(),
// 创建一个查询条件包装器
new EntityWrapper<ZhiyeguihuaEntity>()
);
// 返回分页工具类对象,包含分页信息
return new PageUtils(page);
}
// 重写 queryPage 方法,根据参数和查询条件查询职业规划视图的分页数据
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ZhiyeguihuaEntity> wrapper) {
Page<ZhiyeguihuaView> page =new Query<ZhiyeguihuaView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
@Override
// 创建一个分页对象,根据传入的参数进行初始化
Page<ZhiyeguihuaView> page = new Query<ZhiyeguihuaView>(params).getPage();
// 设置分页对象的记录列表,通过基础映射器的 selectListView 方法查询
page.setRecords(baseMapper.selectListView(page, wrapper));
// 创建分页工具类对象,包含分页信息
PageUtils pageUtil = new PageUtils(page);
// 返回分页工具类对象
return pageUtil;
}
// 重写 selectListVO 方法,根据查询条件查询职业规划值对象的列表数据
@Override
public List<ZhiyeguihuaVO> selectListVO(Wrapper<ZhiyeguihuaEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
// 调用基础映射器的 selectListVO 方法进行查询
return baseMapper.selectListVO(wrapper);
}
// 重写 selectVO 方法,根据查询条件查询单个职业规划值对象
@Override
public ZhiyeguihuaVO selectVO(Wrapper<ZhiyeguihuaEntity> wrapper) {
return baseMapper.selectVO(wrapper);
// 调用基础映射器的 selectVO 方法进行查询
return baseMapper.selectVO(wrapper);
}
// 重写 selectListView 方法,根据查询条件查询职业规划视图的列表数据
@Override
public List<ZhiyeguihuaView> selectListView(Wrapper<ZhiyeguihuaEntity> wrapper) {
// 调用基础映射器的 selectListView 方法进行查询
return baseMapper.selectListView(wrapper);
}
// 重写 selectView 方法,根据查询条件查询单个职业规划视图
@Override
public ZhiyeguihuaView selectView(Wrapper<ZhiyeguihuaEntity> wrapper) {
// 调用基础映射器的 selectView 方法进行查询
return baseMapper.selectView(wrapper);
}
}
}
Loading…
Cancel
Save