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