Commit f8c06074 authored by liuyang's avatar liuyang

update

parent 101b2ce6
......@@ -41,6 +41,7 @@ public class CourseConsumeRecordController {
CourseConsumeRecordPO cacheModel = (CourseConsumeRecordPO) redisTemplate.opsForHash().get(BizConstants.CACHE_KE_CONSUME_RECORD,model.getUuid());
cacheModel.setWatchTime(model.getLearnDuration());
cacheModel.setVideoTime(model.getVideoDuration());
cacheModel.setUpdateTime(LocalDateTime.now());
redisTemplate.opsForHash().put(BizConstants.CACHE_KE_CONSUME_RECORD,cacheModel.getId(),cacheModel);
}else {
CourseConsumeRecordPO po = new CourseConsumeRecordPO();
......@@ -51,6 +52,7 @@ public class CourseConsumeRecordController {
po.setWatchTime(model.getLearnDuration());
po.setVideoTime(model.getVideoDuration());
po.setCreateTime(model.getStartTime());
po.setUpdateTime(model.getStartTime());
redisTemplate.opsForHash().put(BizConstants.CACHE_KE_CONSUME_RECORD,po.getId(),po);
}
......
......@@ -21,7 +21,7 @@
WHERE r.is_del = 0
and r.user_id = #{userId}
and r.course_id = #{courseId}
ORDER BY c.update_time DESC
ORDER BY r.update_time DESC
LIMIT 1
</select>
<select id="queryUserRecordPage" resultType="com.qkdata.biz.web.vo.CourseConsumeRecordModel">
......@@ -38,15 +38,20 @@
res.video_id
FROM (
SELECT *
from
(
SELECT *
from course_consume_record
GROUP BY user_id,course_id
HAVING MAX(update_time)
WHERE user_id = #{userId}
and is_del = 0
ORDER BY update_time desc,course_id ASC LIMIT 100000
) t
GROUP BY course_id
HAVING max(update_time)
) r
INNER JOIN course c on r.course_id = c.id
INNER JOIN course_chapter chapter on chapter.id = r.chapter_id
INNER JOIN resource res ON res.id = chapter.resource_id
WHERE r.is_del = 0
and r.user_id = #{p.userId}
ORDER BY r.update_time DESC
ORDER BY r.update_time DESC;
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment