mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-25 04:11:41 +08:00
课程详情api返回学员的课时学习记录
This commit is contained in:
@@ -3,6 +3,8 @@ package xyz.playedu.api.service;
|
||||
import xyz.playedu.api.domain.UserCourseHourRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tengteng
|
||||
* @description 针对表【user_course_hour_records】的数据库操作Service
|
||||
@@ -14,4 +16,6 @@ public interface UserCourseHourRecordService extends IService<UserCourseHourReco
|
||||
UserCourseHourRecord storeOrUpdate(Integer userId, Integer courseId, Integer hourId, Integer duration, Integer totalDuration);
|
||||
|
||||
Integer getFinishedHourCount(Integer userId, Integer courseId);
|
||||
|
||||
List<UserCourseHourRecord> getRecords(Integer userId, Integer courseId);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import xyz.playedu.api.mapper.UserCourseHourRecordMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tengteng
|
||||
@@ -81,6 +82,11 @@ public class UserCourseHourRecordServiceImpl extends ServiceImpl<UserCourseHourR
|
||||
public Integer getFinishedHourCount(Integer userId, Integer courseId) {
|
||||
return Math.toIntExact(count(query().getWrapper().eq("user_id", userId).eq("course_id", courseId).eq("is_finished", 1)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserCourseHourRecord> getRecords(Integer userId, Integer courseId) {
|
||||
return list(query().getWrapper().eq("user_id", userId).eq("course_id", courseId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user