|
@@ -38,6 +38,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="endTime" column="end_time"/>
|
|
|
</resultMap>
|
|
|
|
|
|
+ <resultMap type="com.zhongzheng.modules.user.vo.SubjectStudyRecordVo" id="SubjectStudyRecordVoResult">
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
+ <result property="subjectId" column="subject_id"/>
|
|
|
+ <result property="courseId" column="course_id"/>
|
|
|
+ <result property="subjectName" column="subject_name"/>
|
|
|
+ <result property="courseName" column="course_name"/>
|
|
|
+ <result property="beginStatus" column="begin_status"/>
|
|
|
+ <result property="moduleNum" column="module_num"/>
|
|
|
+ <result property="chapterNum" column="chapter_num"/>
|
|
|
+ <result property="sectionNum" column="section_num"/>
|
|
|
+ <result property="recordNum" column="record_num"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="com.zhongzheng.modules.user.vo.SectionStudyRecordVo" id="SectionStudyRecordVoResult">
|
|
|
+ <result property="sectionId" column="section_id"/>
|
|
|
+ <result property="moduleName" column="module_name"/>
|
|
|
+ <result property="chapterName" column="chapter_name"/>
|
|
|
+ <result property="sectionName" column="section_name"/>
|
|
|
+ <result property="durationTime" column="duration_time"/>
|
|
|
+ <result property="startTime" column="start_time"/>
|
|
|
+ <result property="endTime" column="end_time"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo" resultMap="UserStudyRecordResult">
|
|
|
SELECT DISTINCT
|
|
|
temp.course_id,
|
|
@@ -81,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
(SELECT s.school_name FROM school s where s.id = g.school_id) as school_name,
|
|
|
(SELECT e.education_name FROM course_education_type e where e.id = g.education_type_id) as education_name,
|
|
|
(SELECT r.start_time FROM user_study_record r LEFT JOIN goods_course c on r.course_id= c.course_id where 1=1 AND g.goods_id=c.goods_id ORDER BY r.start_time ASC) as start_time,
|
|
|
- (SELECT r.end_time FROM user_study_record r LEFT JOIN goods_course c on r.course_id= c.course_id where 1=1 AND g.goods_id=c.goods_id ORDER BY r.start_time ASC) as end_time
|
|
|
+ (SELECT r.end_time FROM user_study_record r LEFT JOIN goods_course c on r.course_id= c.course_id where 1=1 AND g.goods_id=c.goods_id ORDER BY r.star t_time ASC) as end_time
|
|
|
FROM
|
|
|
class_grade_user u
|
|
|
LEFT JOIN class_grade_goods d ON u.grade_id = d.grade_id
|
|
@@ -91,4 +115,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
and u.user_id = #{userId}
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="listSubject" parameterType="com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo" resultMap="SubjectStudyRecordVoResult">
|
|
|
+ SELECT
|
|
|
+ u.user_id,
|
|
|
+ r.subject_id,
|
|
|
+ r.course_id,
|
|
|
+ r.course_name,
|
|
|
+ (SELECT subject_name FROM course_subject s where s.id = r.subject_id) as subject_name,
|
|
|
+ (CASE WHEN (SELECT COUNT(id) FROM course_menu m where m.course_id = r.course_id and m.type in(1,2,3))> 0 THEN '1' ELSE '0' END) as begin_status,
|
|
|
+ (SELECT COUNT(id) FROM course_menu m where m.course_id = r.course_id and m.type in(1)) as module_num,
|
|
|
+ (SELECT COUNT(id)+(SELECT COUNT(p.id) FROM course_module_chapter p LEFT JOIN course_menu m on m.menu_id = p.module_id where m.course_id = r.course_id and m.type in(1)) FROM course_menu m where m.course_id = r.course_id and m.type in(2)) as chapter_num,
|
|
|
+ (SELECT COUNT(id)+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_module_chapter p on n.chapter_id = p.chapter_id LEFT JOIN course_menu m on m.menu_id = p.module_id where m.course_id = r.course_id and m.type in(1))+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_menu m on m.menu_id = n.chapter_id where m.course_id = r.course_id and m.type in(2)) FROM course_menu m where m.course_id = r.course_id and m.type in(3)) as section_num,
|
|
|
+ (select COUNT(DISTINCT record_id) FROM user_study_record c where c.course_id = r.course_id and c.status = 1) as record_num
|
|
|
+ FROM
|
|
|
+ goods_course c
|
|
|
+ LEFT JOIN course r ON c.course_id = r.course_id
|
|
|
+ LEFT JOIN user_study_record u on u.course_id = r.course_id
|
|
|
+ where 1=1
|
|
|
+ <if test="userId != null and userId !=''">
|
|
|
+ and u.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="goodId != null and goodId !=''">
|
|
|
+ and c.goods_id =#{goodId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="listSection" parameterType="com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo" resultMap="SectionStudyRecordVoResult">
|
|
|
+ SELECT
|
|
|
+ DISTINCT r.section_id,
|
|
|
+ (select m.module_name FROM course_module m where r.module_id = m.module_id) as module_name,
|
|
|
+ (select m.name FROM course_chapter m where r.chapter_id = m.chapter_id) as chapter_name,
|
|
|
+ (select m.`name` FROM course_section m where r.section_id = m.section_id) as section_name,
|
|
|
+ (select m.duration_time FROM course_section m where r.section_id = m.section_id) as duration_time,
|
|
|
+ (select i.start_time FROM user_study_record i where r.section_id = i.section_id ORDER BY i.start_time ASC LIMIT 1) as start_time,
|
|
|
+ (select i.end_time FROM user_study_record i where r.section_id = i.section_id ORDER BY i.start_time DESC LIMIT 1) as end_time,
|
|
|
+ r.status
|
|
|
+ FROM
|
|
|
+ user_study_record r
|
|
|
+ LEFT JOIN course c ON c.course_id = r.course_id
|
|
|
+ where 1=1
|
|
|
+ <if test="userId != null and userId !=''">
|
|
|
+ and r.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="courseId != null and courseId !=''">
|
|
|
+ and r.course_id =#{courseId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|