mirror of
https://github.com/PlayEdu/PlayEdu
synced 2026-02-25 16:36:21 +08:00
返回线上课学员的学习记录最早的学习时间
This commit is contained in:
@@ -50,4 +50,6 @@ public interface UserCourseHourRecordMapper extends BaseMapper<UserCourseHourRec
|
||||
Long paginateCount(UserCourseHourRecordPaginateFilter filter);
|
||||
|
||||
List<UserCourseHourRecord> getUserPerCourseEarliestRecord(Integer userId);
|
||||
|
||||
List<UserCourseHourRecord> getCoursePerUserEarliestRecord(Integer courseId);
|
||||
}
|
||||
|
||||
@@ -68,4 +68,6 @@ public interface UserCourseHourRecordService extends IService<UserCourseHourReco
|
||||
int page, int size, UserCourseHourRecordPaginateFilter filter);
|
||||
|
||||
List<UserCourseHourRecord> getUserPerCourseEarliestRecord(Integer userId);
|
||||
|
||||
List<UserCourseHourRecord> getCoursePerUserEarliestRecord(Integer courseId);
|
||||
}
|
||||
|
||||
@@ -184,4 +184,9 @@ public class UserCourseHourRecordServiceImpl
|
||||
public List<UserCourseHourRecord> getUserPerCourseEarliestRecord(Integer userId) {
|
||||
return getBaseMapper().getUserPerCourseEarliestRecord(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserCourseHourRecord> getCoursePerUserEarliestRecord(Integer courseId) {
|
||||
return getBaseMapper().getCoursePerUserEarliestRecord(courseId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,4 +168,25 @@
|
||||
AND `b`.`course_id` = `a`.`course_id`
|
||||
AND `b`.`user_id` = `a`.`user_id`;
|
||||
</select>
|
||||
|
||||
<select id="getCoursePerUserEarliestRecord" resultType="xyz.playedu.course.domain.UserCourseHourRecord">
|
||||
SELECT
|
||||
`a`.*
|
||||
FROM
|
||||
`user_course_hour_records` AS `a`
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
min(`created_at`) AS `min_created_at`,
|
||||
`course_id`,
|
||||
`user_id`
|
||||
FROM
|
||||
`user_course_hour_records`
|
||||
WHERE
|
||||
`course_id` = #{courseId}
|
||||
GROUP BY
|
||||
`course_id`,
|
||||
`user_id`) AS `b` ON `b`.`min_created_at` = `a`.`created_at`
|
||||
AND `b`.`course_id` = `a`.`course_id`
|
||||
AND `b`.`user_id` = `a`.`user_id`;
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user