|
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import com.teaching.backend.common.BaseResponse; |
|
|
|
|
import com.teaching.backend.common.ResultUtils; |
|
|
|
|
import com.teaching.backend.mapper.Knowtemp.KnowtmpMapper; |
|
|
|
|
import com.teaching.backend.mapper.records.KnowledgeLearningRecordMapper; |
|
|
|
|
import com.teaching.backend.mapper.umsAdmin.UmsUserMapper; |
|
|
|
|
|
|
|
|
@ -54,6 +55,7 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea |
|
|
|
|
@Resource |
|
|
|
|
private RecordKnowledgeFinishServiceImpl recordKnowledgeFinishService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BaseResponse<String> saveCoursesRecords(KnowledgeLearningRecord knowledgeLearningRecord) { |
|
|
|
|
//知识点id
|
|
|
|
@ -213,4 +215,18 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea |
|
|
|
|
return coursesList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public BaseResponse<String> studentFinish(String userId, String courseId) { |
|
|
|
|
//获取学生该课程已完成的知识点数量
|
|
|
|
|
Long count = recordKnowledgeFinishService.query() |
|
|
|
|
.eq("user_id", userId) |
|
|
|
|
.eq("course_id", courseId) |
|
|
|
|
.count(); |
|
|
|
|
//获取这门课程的总知识点数
|
|
|
|
|
BaseResponse<Long> allKnows = knowtmpService.getAllKnows(courseId); |
|
|
|
|
double finish = (double) count /allKnows.getData() * 100; |
|
|
|
|
System.out.println(finish); |
|
|
|
|
return ResultUtils.success(String.valueOf(finish)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|