Browse Source

fix 学习记录

he2802 3 years ago
parent
commit
a7a840e8f6

+ 9 - 7
zhongzheng-system/src/main/resources/mapper/modules/user/UserStudyRecordMapper.xml

@@ -260,6 +260,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN course_menu m on m.menu_id = c.chapter_id
             LEFT JOIN course_section s ON c.section_id = s.section_id
             RIGHT JOIN (SELECT
+            usr.chapter_id,
             any_value ( usr.first_start_time ) start_time,
             any_value ( usr.video_current_time ) video_current_time,
             any_value ( usr.end_time ) end_time,
@@ -277,12 +278,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND grade_id = #{gradeId}
             </if>
             AND module_id = 0
-            AND chapter_id = c.chapter_id
             AND course_id = #{courseId} ORDER BY record_id DESC LIMIT 9999 ) usr
             GROUP BY
-            usr.section_id) usr1 on s.section_id = usr1.section_id
+            usr.chapter_id,usr.section_id) usr1 on s.section_id = usr1.section_id
         WHERE
-            m.type =2
+            m.type =2 AND usr1.chapter_id = c.chapter_id
         <if test="courseId != null and courseId !=''">
             and m.course_id=#{courseId}
         </if>
@@ -303,6 +303,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             LEFT JOIN course_menu m on m.menu_id = e.module_id
             LEFT JOIN course_section s ON c.section_id = s.section_id
         RIGHT JOIN (SELECT
+        usr.module_id,
+        usr.chapter_id,
         any_value ( usr.first_start_time ) start_time,
         any_value ( usr.video_current_time ) video_current_time,
         any_value ( usr.end_time ) end_time,
@@ -310,8 +312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         any_value ( usr.section_id ) section_id
         FROM
         ( SELECT * FROM user_study_record WHERE 1=1
-        AND module_id = e.module_id
-        AND chapter_id = c.chapter_id
+
         <if test="userId != null and userId !=''">
             AND user_id = #{userId}
         </if>
@@ -323,9 +324,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         AND course_id = #{courseId} ORDER BY record_id DESC LIMIT 9999 ) usr
         GROUP BY
-        usr.section_id) usr1 on s.section_id = usr1.section_id
+        usr.section_id,usr.module_id,
+        usr.chapter_id) usr1 on s.section_id = usr1.section_id
         WHERE
-            m.type =1
+            m.type =1 and usr1.module_id = e.module_id and usr1.chapter_id = e.chapter_id
         <if test="courseId != null and courseId !=''">
             and m.course_id=#{courseId}
         </if>