From dd6e7d9dc24cb4f6d98a67151930c1dc9f7a6502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=BB=E8=A3=81?= <14186472+wenyu441069198@user.noreply.gitee.com> Date: Mon, 12 Aug 2024 18:51:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=82=96=E6=B5=B7=E5=8D=97=E6=9F=A5=E8=80=81?= =?UTF-8?q?=E5=B8=88=E6=89=80=E6=95=99=E7=9A=84=E5=AD=A6=E7=94=9F=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/mapper/umsAdmin/UmsUserMapper.java | 3 +-- .../impl/courses/CoursesServiceImpl.java | 17 ++++++++++------- .../impl/favour/SeCourseFavourServiceImpl.java | 5 +---- .../CourseLearningRecordServiceImpl.java | 4 ++-- .../KnowledgeLearningRecordServiceImpl.java | 8 +------- src/main/resources/mapper/UmsUserMapper.xml | 2 +- 6 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsUserMapper.java b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsUserMapper.java index 7f422de..8ce099d 100644 --- a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsUserMapper.java +++ b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsUserMapper.java @@ -1,7 +1,6 @@ package com.teaching.backend.mapper.umsAdmin; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.teaching.backend.model.entity.courses.StudentCourses; import com.teaching.backend.model.entity.umsAdmin.UmsRole; import com.teaching.backend.model.entity.umsAdmin.UmsTeacher; import com.teaching.backend.model.entity.umsAdmin.UmsUser; @@ -19,5 +18,5 @@ public interface UmsUserMapper extends BaseMapper { UmsStudentVO getByIdStudent(String id); - String getbyIdRoleId(String userId); + String getByIdRoleId(String userId); } diff --git a/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java index 0056187..24f8d03 100644 --- a/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java @@ -361,6 +361,7 @@ public class CoursesServiceImpl extends ServiceImpl impl @Override public List queryStudentList(String userId) { LinkedHashSet umsStudentManageList = queryTeacherByStudentList(userId); + System.out.println("1111111"+umsStudentManageList); List personalCenterStudentListVOList = new ArrayList<>(); PersonalCenterStudentListVO personalCenterStudentListVO = null; for (UmsStudentManage umsStudentManage : umsStudentManageList) { @@ -375,7 +376,7 @@ public class CoursesServiceImpl extends ServiceImpl impl @Override public LinkedHashSet queryTeacherByStudentList(String userId) { - String roleId = umsUserMapper.getbyIdRoleId(userId); + String roleId = umsUserMapper.getByIdRoleId(userId); CourseQuery courseQuery = new CourseQuery(); courseQuery.setUserId(userId); LinkedHashSet umsStudentManageList = new LinkedHashSet<>(); @@ -388,13 +389,15 @@ public class CoursesServiceImpl extends ServiceImpl impl List courseLearningRecordList = new ArrayList<>(); for (StudentCourses studentUsername : studentUsernames) { CourseLearningRecord courseLearningRecord = courseLearningRecordMapper.selectNewRecord(String.valueOf(studentUsername.getStudent())); - courseLearningRecordList.add(courseLearningRecord); - } - courseLearningRecordList = courseLearningRecordList.stream().sorted(Comparator.comparing(CourseLearningRecord::getTimes).reversed()).collect(Collectors.toList()); - for (CourseLearningRecord courseLearningRecord : courseLearningRecordList) { - UmsStudentManage umsStudentManage = umsStudentManageMapper.queryStudent(courseLearningRecord.getUserId()); - umsStudentManageList.add(umsStudentManage); + if (courseLearningRecord != null){ + courseLearningRecordList.add(courseLearningRecord); + } } + courseLearningRecordList = courseLearningRecordList.stream().sorted(Comparator.comparing(CourseLearningRecord::getTimes).reversed()).collect(Collectors.toList()); + for (CourseLearningRecord courseLearningRecord : courseLearningRecordList) { + UmsStudentManage umsStudentManage = umsStudentManageMapper.queryStudent(courseLearningRecord.getUserId()); + umsStudentManageList.add(umsStudentManage); + } } return umsStudentManageList; } diff --git a/src/main/java/com/teaching/backend/service/impl/favour/SeCourseFavourServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/favour/SeCourseFavourServiceImpl.java index a260644..5cac41a 100644 --- a/src/main/java/com/teaching/backend/service/impl/favour/SeCourseFavourServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/favour/SeCourseFavourServiceImpl.java @@ -16,9 +16,6 @@ import com.teaching.backend.mapper.favour.SeCourseFavourMapper; import com.teaching.backend.mapper.umsAdmin.UmsUserMapper; import com.teaching.backend.model.entity.courses.Courses; import com.teaching.backend.model.entity.favour.SeCourseFavour; -import com.teaching.backend.model.entity.favour.SeKnowFavour; -import com.teaching.backend.model.entity.favour.SeResourceFavour; -import com.teaching.backend.model.entity.umsAdmin.UmsUser; import com.teaching.backend.model.vo.courses.CoursesVO; import com.teaching.backend.model.vo.favour.CourseFavourDetailVO; import com.teaching.backend.service.courses.ICoursesService; @@ -157,7 +154,7 @@ public class SeCourseFavourServiceImpl extends ServiceImpl queryNewCollect(String userId) { - String roleId = umsUserMapper.getbyIdRoleId(userId); + String roleId = umsUserMapper.getByIdRoleId(userId); List coursesList = new ArrayList<>(); if (roleId.equals("1")){ //老师 diff --git a/src/main/java/com/teaching/backend/service/impl/records/CourseLearningRecordServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/records/CourseLearningRecordServiceImpl.java index 4c9eae5..fb3e253 100644 --- a/src/main/java/com/teaching/backend/service/impl/records/CourseLearningRecordServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/records/CourseLearningRecordServiceImpl.java @@ -123,7 +123,7 @@ public class CourseLearningRecordServiceImpl extends ServiceImpl queryCourseList(String userId) { - String roleId = umsUserMapper.getbyIdRoleId(userId); + String roleId = umsUserMapper.getByIdRoleId(userId); List coursesList = new ArrayList<>(); if (roleId.equals("1")){ List courseIds = courseLearningRecordMapper.selectMaxNumber(); @@ -148,7 +148,7 @@ public class CourseLearningRecordServiceImpl extends ServiceImpl queryrecommendCourses(String userId) { - String roleId = umsUserMapper.getbyIdRoleId(userId); + String roleId = umsUserMapper.getByIdRoleId(userId); if (roleId.equals("1")) { diff --git a/src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java index cfe8d3e..c392c53 100644 --- a/src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java @@ -12,18 +12,12 @@ import com.teaching.backend.mapper.umsAdmin.UmsUserMapper; import com.teaching.backend.model.entity.KnowGraph.KnowledgeLearningNumber; -import com.teaching.backend.model.entity.courses.CourseLearningNumber; - -import com.teaching.backend.model.entity.courses.Courses; import com.teaching.backend.model.entity.knowtmp.Knowtmp; import com.teaching.backend.model.entity.records.KnowledgeLearningRecord; -import com.teaching.backend.model.vo.courses.CoursesVO; import com.teaching.backend.model.vo.knowGraph.KnowVO; import com.teaching.backend.model.vo.records.KnowledgeLearningRecordVo; -import com.teaching.backend.service.Know.KnowService; -import com.teaching.backend.service.impl.courses.CourseLearningNumberServiceImpl; import com.teaching.backend.service.impl.knowledge.KnowledgeLearningNumberServiceImpl; import com.teaching.backend.service.knowtmp.KnowtmpService; import com.teaching.backend.service.records.IKnowledgeLearningRecordService; @@ -141,7 +135,7 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl queryMaxKnowledge(String userId) { - String roleId = umsUserMapper.getbyIdRoleId(userId); + String roleId = umsUserMapper.getByIdRoleId(userId); List coursesList = new ArrayList<>(); KnowVO knowVO = null; if (roleId.equals("1")){ diff --git a/src/main/resources/mapper/UmsUserMapper.xml b/src/main/resources/mapper/UmsUserMapper.xml index 5b56d4a..6ea4599 100644 --- a/src/main/resources/mapper/UmsUserMapper.xml +++ b/src/main/resources/mapper/UmsUserMapper.xml @@ -76,7 +76,7 @@ WHERE s.user_id = #{id} - SELECT us.role_id roleId FROM