From 026b39b0617303d3a661fdf4e49a71dd77f46d86 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Tue, 11 Feb 2025 15:30:07 +0800 Subject: [PATCH] 1 --- .../base/service/impl/DataViewServiceImpl.java | 14 ++++++++++++-- .../yudao/module/base/vo/StudentInfoVO.java | 2 ++ .../yudao/module/course/mapper/ProcessMapper.java | 2 ++ .../module/course/service/ProcessService.java | 10 ++++++++++ .../course/service/impl/ProcessServiceImpl.java | 14 ++++++++++++++ .../yudao/module/exam/vo/ExamBatchItemVO.java | 6 ++++++ .../iocoder/yudao/module/train/entity/Train.java | 7 +++++++ .../main/resources/mapper/course/ProcessMapper.xml | 11 +++++++++++ 8 files changed, 64 insertions(+), 2 deletions(-) diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DataViewServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DataViewServiceImpl.java index 11e1c7bf..54d50413 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DataViewServiceImpl.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DataViewServiceImpl.java @@ -9,11 +9,15 @@ import cn.iocoder.yudao.module.base.vo.StudentInfoVO; import cn.iocoder.yudao.module.course.entity.Process; import cn.iocoder.yudao.module.course.service.ProcessService; import cn.iocoder.yudao.module.exam.service.ExamBatchItemService; +import cn.iocoder.yudao.module.exam.vo.ExamBatchItemVO; +import cn.iocoder.yudao.module.train.entity.Train; import cn.iocoder.yudao.module.train.service.TrainService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; +import java.util.List; + @Service @Validated public class DataViewServiceImpl implements DataViewService { @@ -45,6 +49,8 @@ public class DataViewServiceImpl implements DataViewService { //当前学习进度 Process process = processService.selectByUserId(id,coachId); studentInfoVO.setProcess(process); + //查这个课程累计总训练时长 + studentInfoVO.setTrainTime(processService.getAllTrainTime(id,process.getCourseId())); //查归属教练信息 DlDriveSchoolCoachRespVO coachRespVO = coachService.getDlDriveSchoolCoachByUserId(process.getCoachId()); if(null!=coachRespVO){ @@ -53,9 +59,13 @@ public class DataViewServiceImpl implements DataViewService { studentInfoVO.setCoachInfo(coachRespVO); } //查该学生的培训记录 - studentInfoVO.setTrainList(trainService.selectByUserIdAndCoachId(id,coachId)); + List trainList = trainService.selectByUserIdAndCoachId(id,coachId); + trainList.forEach(item-> item.setShowMore(false)); + studentInfoVO.setTrainList(trainList); //查该学生的考试记录 - studentInfoVO.setExamList(examBatchItemService.selectByUserIdAndCoachId(id, coachId)); + List examList = examBatchItemService.selectByUserIdAndCoachId(id, coachId); + examList.forEach(item->item.setShowMore(false)); + studentInfoVO.setExamList(examList); return studentInfoVO; } } diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/StudentInfoVO.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/StudentInfoVO.java index 62d8c41a..1743dc2d 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/StudentInfoVO.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/StudentInfoVO.java @@ -14,6 +14,8 @@ public class StudentInfoVO { private DlDriveSchoolStudent studentInfo; /**学习进度*/ private Process process; + /**训练总时长*/ + private Double trainTime; /**教练信息*/ private DlDriveSchoolCoachRespVO coachInfo; /**训练记录*/ diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/mapper/ProcessMapper.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/mapper/ProcessMapper.java index a0f3aa9c..31b70ee5 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/mapper/ProcessMapper.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/mapper/ProcessMapper.java @@ -54,4 +54,6 @@ public interface ProcessMapper extends BaseMapper { * @return cn.iocoder.yudao.module.course.entity.Process **/ Process selectNewMaxByUserId(@Param("userId") Long userId,@Param("coachId") Long coachId); + + Double selectAllTrainTime(@Param("userId") Long userId,@Param("courseId") String courseId); } \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/ProcessService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/ProcessService.java index fbc47ad6..fdaa8404 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/ProcessService.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/ProcessService.java @@ -61,5 +61,15 @@ public interface ProcessService extends IService { * @return java.util.Map **/ Map selectByCoachId(Long coachId); + + /** + * 查某学生某课程累计总训练时长 + * @author vinjor-M + * @date 14:17 2025/2/11 + * @param userId 学生ID + * @param courseId 课程ID + * @return java.lang.Double + **/ + Double getAllTrainTime(Long userId,String courseId); } diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java index 0271282a..f33481d8 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/course/service/impl/ProcessServiceImpl.java @@ -170,4 +170,18 @@ public class ProcessServiceImpl extends ServiceImpl impl return rtnMap; } + /** + * 查某学生某课程累计总训练时长 + * + * @param userId 学生ID + * @param courseId 课程ID + * @return java.lang.Double + * @author vinjor-M + * @date 14:17 2025/2/11 + **/ + @Override + public Double getAllTrainTime(Long userId, String courseId) { + return processMapper.selectAllTrainTime(userId, courseId); + } + } \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/vo/ExamBatchItemVO.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/vo/ExamBatchItemVO.java index e86ad8b9..2e4aa9a7 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/vo/ExamBatchItemVO.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/exam/vo/ExamBatchItemVO.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.exam.vo; import cn.iocoder.yudao.module.exam.entity.ExamBatchItem; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.Data; import java.util.Date; @@ -48,4 +49,9 @@ public class ExamBatchItemVO extends ExamBatchItem { * 考试交通方式 */ private String transWay; + /** + * 是否展示更多 + */ + @TableField(exist = false) + private Boolean showMore; } diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/Train.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/Train.java index 52d0eded..298c62f4 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/Train.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/train/entity/Train.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.train.entity; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; @@ -123,4 +124,10 @@ public class Train extends TenantBaseDO { */ private String evaluateId; + /** + * 是否展示更多 + */ + @TableField(exist = false) + private Boolean showMore; + } \ No newline at end of file diff --git a/dl-module-jx/src/main/resources/mapper/course/ProcessMapper.xml b/dl-module-jx/src/main/resources/mapper/course/ProcessMapper.xml index a607dd42..a88a966f 100644 --- a/dl-module-jx/src/main/resources/mapper/course/ProcessMapper.xml +++ b/dl-module-jx/src/main/resources/mapper/course/ProcessMapper.xml @@ -31,4 +31,15 @@ ORDER BY dsp.`subject` DESC, dsp.create_time DESC LIMIT 1 +