|
@@ -269,6 +269,69 @@
|
|
|
ORDER BY o.create_time desc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="listDangAnSubject" parameterType="com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo"
|
|
|
+ resultMap="SubjectStudyRecordVoResult">
|
|
|
+ SELECT
|
|
|
+ #{userId} as user_id,
|
|
|
+ r.subject_id,
|
|
|
+ r.course_id,
|
|
|
+ r.course_name,
|
|
|
+ (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
|
|
|
+ <if test="tenantId != null and tenantId !=''">
|
|
|
+ and p.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ LEFT JOIN course_menu m on m.menu_id = p.module_id
|
|
|
+ <if test="tenantId != null and tenantId !=''">
|
|
|
+ and m.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ where m.course_id = r.course_id
|
|
|
+ and m.type in (1)
|
|
|
+ <if test="tenantId != null and tenantId !=''">
|
|
|
+ and n.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ )+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_menu m on m.menu_id =
|
|
|
+ n.chapter_id
|
|
|
+ <if test="tenantId != null and tenantId !=''">
|
|
|
+ and m.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ where m.course_id = r.course_id and m.type in (2)
|
|
|
+ <if test="tenantId != null and tenantId !=''">
|
|
|
+ and n.tenant_id=#{tenantId}
|
|
|
+ </if>) FROM course_menu m where m.course_id =
|
|
|
+ r.course_id and m.type in (3)
|
|
|
+ <if test="tenantId != null and tenantId !=''">
|
|
|
+ and m.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ ) as section_num,
|
|
|
+ (select COUNT(DISTINCT course_id,module_id,chapter_id,section_id) FROM user_study_record c where 1=1
|
|
|
+ AND c.course_id = r.course_id
|
|
|
+ and c.current_status=1
|
|
|
+ <if test="gradeId != null and gradeId !=''">
|
|
|
+ and c.grade_id=#{gradeId}
|
|
|
+ </if>
|
|
|
+ <if test="orderGoodsId != null and orderGoodsId !=''">
|
|
|
+ and c.order_goods_id=#{orderGoodsId}
|
|
|
+ </if>
|
|
|
+ <if test="tenantId != null and tenantId !=''">
|
|
|
+ and c.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ and c.user_id=#{userId} and c.status = 1 and c.goods_id = #{goodsId}) as record_num
|
|
|
+ FROM
|
|
|
+ course r
|
|
|
+ LEFT JOIN goods_course c ON c.course_id = r.course_id
|
|
|
+ <if test="tenantId != null and tenantId !=''">
|
|
|
+ and c.tenant_id=#{tenantId}
|
|
|
+ </if>
|
|
|
+ where 1=1
|
|
|
+ <if test="goodsId != null and goodsId !=''">
|
|
|
+ and c.goods_id =#{goodsId}
|
|
|
+ </if>
|
|
|
+ <if test="courseId != null and courseId !=''">
|
|
|
+ and c.course_id =#{courseId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
|
|
|
<select id="listSubject" parameterType="com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo"
|
|
|
resultMap="SubjectStudyRecordVoResult">
|