@ -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,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…
Reference in new issue