|
|
@ -9,6 +9,7 @@ import com.teaching.backend.mapper.records.LearningRecordsMapper; |
|
|
|
|
|
|
|
|
|
|
|
import com.teaching.backend.model.entity.records.LearningRecords; |
|
|
|
import com.teaching.backend.model.entity.records.LearningRecords; |
|
|
|
import com.teaching.backend.model.vo.records.LearningRecordsVo; |
|
|
|
import com.teaching.backend.model.vo.records.LearningRecordsVo; |
|
|
|
|
|
|
|
import com.teaching.backend.service.impl.CourseResourcesServiceImpl; |
|
|
|
import com.teaching.backend.service.impl.chapter.ChapterServiceImpl; |
|
|
|
import com.teaching.backend.service.impl.chapter.ChapterServiceImpl; |
|
|
|
import com.teaching.backend.service.impl.courses.CoursesServiceImpl; |
|
|
|
import com.teaching.backend.service.impl.courses.CoursesServiceImpl; |
|
|
|
import com.teaching.backend.service.impl.know.KnowServiceimpl; |
|
|
|
import com.teaching.backend.service.impl.know.KnowServiceimpl; |
|
|
@ -31,8 +32,8 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe |
|
|
|
private CoursesServiceImpl coursesService; |
|
|
|
private CoursesServiceImpl coursesService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private LearningRecordsMapper learningRecordsMapper; |
|
|
|
private LearningRecordsMapper learningRecordsMapper; |
|
|
|
// @Autowired
|
|
|
|
@Autowired |
|
|
|
// private LearningResourceServiceImpl learningResourceService;
|
|
|
|
private CourseResourcesServiceImpl courseResourcesService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private KnowServiceimpl knowledgePointService; |
|
|
|
private KnowServiceimpl knowledgePointService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
@ -91,7 +92,7 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe |
|
|
|
//添加课程名称
|
|
|
|
//添加课程名称
|
|
|
|
switch (learningRecords.getType()) { |
|
|
|
switch (learningRecords.getType()) { |
|
|
|
case "4": //如果是资源学习
|
|
|
|
case "4": //如果是资源学习
|
|
|
|
learningRecordsVo.setCoursesName("学习资源");//设置名称 --------------------------------------------待完善
|
|
|
|
learningRecordsVo.setCoursesName(courseResourcesService.getById(learningRecords.getCoursesId()).getName());//设置名称 --------------------------------------------待完善
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case "3": //如果是知识点学习记录
|
|
|
|
case "3": //如果是知识点学习记录
|
|
|
@ -106,7 +107,6 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe |
|
|
|
System.out.println(); |
|
|
|
System.out.println(); |
|
|
|
learningRecordsVo.setCoursesName(coursesService.getById(learningRecords.getCoursesId()).getName()); |
|
|
|
learningRecordsVo.setCoursesName(coursesService.getById(learningRecords.getCoursesId()).getName()); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//添加观看人数
|
|
|
|
//添加观看人数
|
|
|
|
//统计记录表里有多少人查看过这门资源
|
|
|
|
//统计记录表里有多少人查看过这门资源
|
|
|
@ -129,6 +129,9 @@ public class LearningRecordsServiceImpl extends ServiceImpl<LearningRecordsMappe |
|
|
|
public String saveRecords(LearningRecords learningRecords) { |
|
|
|
public String saveRecords(LearningRecords learningRecords) { |
|
|
|
String userId = learningRecords.getUserId(); |
|
|
|
String userId = learningRecords.getUserId(); |
|
|
|
String coursesId = learningRecords.getCoursesId(); |
|
|
|
String coursesId = learningRecords.getCoursesId(); |
|
|
|
|
|
|
|
//如果userId或者coursesId为空就抛出异常事务回滚----------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("学习记录:"+learningRecords); |
|
|
|
System.out.println("学习记录:"+learningRecords); |
|
|
|
//查找该用户是否观看过该学习资源
|
|
|
|
//查找该用户是否观看过该学习资源
|
|
|
|
LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
LambdaQueryWrapper<LearningRecords> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|