he2802 hace 3 años
padre
commit
0c061c82e5

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java

@@ -359,6 +359,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
             goodsUserVo.setClassEndTime(classGradeVo.getClassEndTime());
             goodsUserVo.setPeriodStatus(classGradeVo.getPeriodStatus());
             goodsUserVo.setClassStatus(classGradeVo.getClassStatus());
+            goodsUserVo.setRecordNum(classGradeVo.getRecordNum());
+            goodsUserVo.setExamNum(classGradeVo.getExamNum());
             Long secLong = 0L;
             Long studyLong = 0L;
             SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseUserVo.java

@@ -125,4 +125,10 @@ public class CourseUserVo {
 	@Excel(name = "1 需重修")
 	@ApiModelProperty("1 需重修")
 	private Integer rebuild;
+	/** 节数 */
+	@ApiModelProperty("试卷数")
+	private Long examNum;
+	/** 已做试卷 */
+	@ApiModelProperty("已做试卷")
+	private Long recordNum;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserVo.java

@@ -324,5 +324,11 @@ public class GoodsUserVo {
 	private Integer classStatus;
 	@ApiModelProperty("预约ID")
 	private Integer subscribeId;
+	/** 节数 */
+	@ApiModelProperty("试卷数")
+	private Long examNum;
+	/** 已做试卷 */
+	@ApiModelProperty("已做试卷")
+	private Long recordNum;
 
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassGradeVo.java

@@ -137,4 +137,13 @@ public class ClassGradeVo {
 
 	@ApiModelProperty("学时审批状态 0 未通过 1通过 2待审核 -1 不可审核")
 	private Integer periodStatus;
+
+	/** 节数 */
+	@ApiModelProperty("试卷数")
+	private Long examNum;
+
+
+	/** 已做试卷 */
+	@ApiModelProperty("已做试卷")
+	private Long recordNum;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserExamRecordQueryBo.java

@@ -57,6 +57,10 @@ public class UserExamRecordQueryBo extends BaseEntity {
 	private Long performance;
 	@ApiModelProperty("试卷类型ID")
 	private Long paperId;
+	@ApiModelProperty("模块卷ID")
+	private Long moduleExamId;
+	@ApiModelProperty("章卷ID")
+	private Long chapterExamId;
 
 
 }

+ 45 - 2
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -85,6 +85,8 @@
         <result property="schoolName" column="school_name"/>
         <result property="categoryName" column="category_name"/>
         <result property="subjectName" column="subject_name"/>
+        <result property="examNum" column="exam_num"/>
+        <result property="recordNum" column="record_num"/>
     </resultMap>
     <resultMap type="com.zhongzheng.modules.goods.vo.GoodsPeriodVo" id="GoodsPeriodVo">
         <result property="goodsId" column="goods_id"/>
@@ -206,6 +208,8 @@
         <result property="interfacePushName" column="interface_push_name"/>
         <result property="studentNum" column="student_num"/>
         <result property="periodStatus" column="period_status"/>
+        <result property="examNum" column="exam_num"/>
+        <result property="recordNum" column="record_num"/>
     </resultMap>
 
 
@@ -499,10 +503,36 @@
     <select id="courseList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo"  resultMap="CourseUserVo">
         SELECT
             c.*,
-                #{gradeId} as grade_id
+                #{gradeId} as grade_id,
+        <if test="userId != null ">
+            (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr  where ubr.`status`=1 and ubr.course_id= gc.course_id and ubr.report_status=1 and ubr.grade_id = #{gradeId} and ubr.user_id = #{userId} and ubr.current_status = 1) as record_num,
+        </if>
+            IFNULL(ge.exam_num,0) as exam_num
         FROM
             course c
                 LEFT JOIN goods_course gc ON gc.course_id = c.course_id
+                LEFT JOIN (SELECT
+                               COUNT( m.id ) AS exam_num,
+                               m.course_id
+                           FROM
+                               course_menu_exam m
+
+                           where
+                               m.type = 1 GROUP BY m.course_id
+            ) ge on gc.course_id = ge.course_id
+        where 1=1
+          and gc.goods_id =#{goodsId}
+        order by gc.sort asc
+    </select>
+
+    <select id="courseExamNum" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo"  resultMap="CourseUserVo">
+        SELECT
+            c.*,
+            #{gradeId} as grade_id
+        FROM
+            course c
+                LEFT JOIN goods_course gc ON gc.course_id = c.course_id
+
         where 1=1
           and gc.goods_id =#{goodsId}
         order by gc.sort asc
@@ -520,8 +550,12 @@
           AND ups.`status` = 0
           AND ups.period_status = 1
     </select>
-    <select id="gradeIdSelect" parameterType="map"  resultMap="ClassGradeVoResult">
+    <select id="gradeIdSelect" parameterType="map"  resultMap="ClassGradeVoResult" >
         SELECT
+
+               IFNULL(ge.exam_num,0) as exam_num,
+        (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
+        = ubr.goods_id where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
             cgu.grade_id,
             cg.class_start_time,
             cg.class_end_time,
@@ -534,6 +568,15 @@
             class_grade_user cgu
                 LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
                 LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
+        LEFT JOIN (SELECT
+        COUNT( m.id ) AS exam_num,
+        c.goods_id
+        FROM
+        course_menu_exam m
+        LEFT JOIN goods_course c ON m.course_id = c.course_id
+        where
+        m.type = 1
+        GROUP BY c.goods_id ) ge on #{goodsId} = ge.goods_id
         WHERE
             1=1
         <if test="gradeId != null and gradeId != ''">

+ 6 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamRecordMapper.xml

@@ -105,6 +105,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="examId != null and examId != ''">
             AND ue.exam_id = #{examId}
         </if>
+        <if test="moduleExamId != null and moduleExamId != ''">
+            AND ue.module_exam_id = #{moduleExamId}
+        </if>
+        <if test="chapterExamId != null and chapterExamId != ''">
+            AND ue.chapter_exam_id = #{chapterExamId}
+        </if>
         ORDER by ue.record_id DESC
     </select>