|
@@ -78,6 +78,34 @@
|
|
<result property="cheat" column="cheat"/>
|
|
<result property="cheat" column="cheat"/>
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
+ <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
|
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
|
+ <result property="id" column="id"/>
|
|
|
|
+ <result property="typeName" column="type_name"/>
|
|
|
|
+ <result property="realName" column="realname"/>
|
|
|
|
+ <result property="classHours" column="class_hours"/>
|
|
|
|
+ <result property="studyStartTime" column="study_start_time"/>
|
|
|
|
+ <result property="status" column="status"/>
|
|
|
|
+ <result property="auditTime" column="audit_time"/>
|
|
|
|
+ <result property="type" column="type"/>
|
|
|
|
+ <result property="courseId" column="course_id"/>
|
|
|
|
+ <result property="studyEndTime" column="study_end_time"/>
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodChapterVo" id="ClassPeriodChapterVo">
|
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
|
+ <result property="id" column="id"/>
|
|
|
|
+ <result property="typeName" column="type_name"/>
|
|
|
|
+ <result property="realName" column="realname"/>
|
|
|
|
+ <result property="classHours" column="class_hours"/>
|
|
|
|
+ <result property="studyStartTime" column="study_start_time"/>
|
|
|
|
+ <result property="status" column="status"/>
|
|
|
|
+ <result property="auditTime" column="audit_time"/>
|
|
|
|
+ <result property="type" column="type"/>
|
|
|
|
+ <result property="studyEndTime" column="study_end_time"/>
|
|
|
|
+ <result property="performance" column="performance"/>
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
<select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
<select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
|
|
resultMap="ClassGradeUserVoResult">
|
|
resultMap="ClassGradeUserVoResult">
|
|
SELECT
|
|
SELECT
|
|
@@ -199,4 +227,170 @@
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="listPeriodAudit" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="ClassPeriodVo">
|
|
|
|
+ SELECT
|
|
|
|
+ cm.menu_id as id,
|
|
|
|
+ cm.course_id,
|
|
|
|
+ (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) as realname,
|
|
|
|
+
|
|
|
|
+ (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) as user_id,
|
|
|
|
+ (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
|
|
|
|
+ (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
|
|
|
|
+ 1 as type,
|
|
|
|
+ NULL as study_start_time,
|
|
|
|
+ NULL as study_end_time
|
|
|
|
+ FROM
|
|
|
|
+ course_menu cm
|
|
|
|
+ LEFT JOIN goods_course gc on gc.course_id = cm.course_id
|
|
|
|
+ where 1=1
|
|
|
|
+ <if test="goodsId != null and goodsId !='' ">
|
|
|
|
+ and gc.goods_id=#{goodsId}
|
|
|
|
+ </if>
|
|
|
|
+ AND cm.type=1
|
|
|
|
+ UNION
|
|
|
|
+ SELECT
|
|
|
|
+ cm.menu_id as id,
|
|
|
|
+ cm.course_id,
|
|
|
|
+ (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) as realname,
|
|
|
|
+ (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) as user_id,
|
|
|
|
+ (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
|
|
|
|
+ (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs where ccs.chapter_id=cm.menu_id) as class_hours,
|
|
|
|
+ 2 as type,
|
|
|
|
+ (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id = ccs.section_id where ccs.chapter_id = cm.menu_id and usr.goods_id = gc.goods_id ORDER BY usr.create_time ASC limit 1) as study_start_time,
|
|
|
|
+ (SELECT usr.update_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id = ccs.section_id where ccs.chapter_id = cm.menu_id and usr.goods_id = gc.goods_id ORDER BY usr.create_time DESC limit 1) as study_end_time
|
|
|
|
+ FROM
|
|
|
|
+ course_menu cm
|
|
|
|
+ LEFT JOIN goods_course gc on gc.course_id = cm.course_id
|
|
|
|
+ where 1=1 <if test="goodsId != null and goodsId !='' ">
|
|
|
|
+ and gc.goods_id=#{goodsId}
|
|
|
|
+ </if> AND cm.type=2
|
|
|
|
+ UNION
|
|
|
|
+ SELECT
|
|
|
|
+ cm.menu_id as id,
|
|
|
|
+ cm.course_id,
|
|
|
|
+ (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) as realname,
|
|
|
|
+ (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) as user_id,
|
|
|
|
+ (SELECT cs.`name` FROM course_section cs where cm.menu_id = cs.section_id) as type_name,
|
|
|
|
+ null as class_hours,
|
|
|
|
+ 3 as type,
|
|
|
|
+ NULL as study_start_time,
|
|
|
|
+ NULL as study_end_time
|
|
|
|
+ FROM
|
|
|
|
+ course_menu cm
|
|
|
|
+ LEFT JOIN goods_course gc on gc.course_id = cm.course_id
|
|
|
|
+ where 1=1 <if test="goodsId != null and goodsId !='' ">
|
|
|
|
+ and gc.goods_id=#{goodsId}
|
|
|
|
+ </if> AND cm.type=3
|
|
|
|
+ UNION
|
|
|
|
+ SELECT
|
|
|
|
+ cme.section_id as id,
|
|
|
|
+ cme.course_id,
|
|
|
|
+ (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) as realname,
|
|
|
|
+ (SELECT u.user_id FROM `user` u where 1=1<if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) as user_id,
|
|
|
|
+ (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
|
|
|
|
+ null as class_hours,
|
|
|
|
+ 4 as type,
|
|
|
|
+ NULL as study_start_time,
|
|
|
|
+ NULL as study_end_time
|
|
|
|
+ FROM
|
|
|
|
+ course_menu_exam cme
|
|
|
|
+ LEFT JOIN goods_course gc on gc.course_id = cme.course_id
|
|
|
|
+ LEFT JOIN course_menu cm on cme.section_id = cm.menu_id
|
|
|
|
+ where 1=1 <if test="goodsId != null and goodsId !='' ">
|
|
|
|
+ and gc.goods_id=#{goodsId}
|
|
|
|
+ </if> AND cm.type=3 and cme.chapter_id=0 and cme.module_id=0 and cme.type=1 and cm.type=3
|
|
|
|
+
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="listperiodChapter" parameterType="map" resultMap="ClassPeriodChapterVo">
|
|
|
|
+ SELECT
|
|
|
|
+ cc.chapter_id as id,
|
|
|
|
+ cm.course_id,
|
|
|
|
+ ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if> ) AS realname,
|
|
|
|
+ ( SELECT u.user_id FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
|
|
|
|
+ and u.user_id = #{userId}
|
|
|
|
+ </if>) AS user_id,
|
|
|
|
+ cc.`name` as type_name,
|
|
|
|
+ ( SELECT COUNT( ccs.section_id ) FROM course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id ) AS class_hours,
|
|
|
|
+ 2 AS type,
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ usr.create_time
|
|
|
|
+ FROM
|
|
|
|
+ user_study_record usr
|
|
|
|
+ LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id
|
|
|
|
+ WHERE
|
|
|
|
+ ccs.chapter_id = cc.chapter_id
|
|
|
|
+ <if test="goodsId != null and goodsId !='' ">
|
|
|
|
+ AND usr.goods_id=#{goodsId}
|
|
|
|
+ </if>
|
|
|
|
+ ORDER BY
|
|
|
|
+ usr.create_time ASC
|
|
|
|
+ LIMIT 1
|
|
|
|
+ ) AS study_start_time,
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ usr.update_time
|
|
|
|
+ FROM
|
|
|
|
+ user_study_record usr
|
|
|
|
+ LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id
|
|
|
|
+ WHERE
|
|
|
|
+ ccs.chapter_id = cc.chapter_id
|
|
|
|
+ <if test="goodsId != null and goodsId !='' ">
|
|
|
|
+ AND usr.goods_id=#{goodsId}
|
|
|
|
+ </if>
|
|
|
|
+ ORDER BY
|
|
|
|
+ usr.create_time DESC
|
|
|
|
+ LIMIT 1
|
|
|
|
+ ) AS study_end_time,
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ ubr.performance
|
|
|
|
+ FROM
|
|
|
|
+ user_bank_record ubr
|
|
|
|
+ LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id
|
|
|
|
+ WHERE 1=1
|
|
|
|
+ <if test="goodsId != null and goodsId !='' ">
|
|
|
|
+ AND ubr.goods_id=#{goodsId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="moduleId != null and moduleId !='' ">
|
|
|
|
+ AND cme.module_id=#{moduleId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="courseId != null and courseId !='' ">
|
|
|
|
+ AND cme.course_id =#{courseId}
|
|
|
|
+ </if>
|
|
|
|
+ AND cme.chapter_id = cmc.chapter_id
|
|
|
|
+ ) AS performance
|
|
|
|
+ FROM
|
|
|
|
+ course_menu cm
|
|
|
|
+ LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
|
|
|
|
+ LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
|
|
|
|
+ WHERE
|
|
|
|
+ 1 = 1
|
|
|
|
+ <if test="moduleId != null and moduleId !='' ">
|
|
|
|
+ AND cmc.module_id=#{moduleId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="courseId != null and courseId !='' ">
|
|
|
|
+ AND cm.course_id =#{courseId}
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
</mapper>
|
|
</mapper>
|