Explorar el Código

fix 模考做题记录与错题记录

tanzh hace 3 años
padre
commit
b9b8c2233d

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

@@ -29,6 +29,10 @@ public class UserMockRecordAddBo {
     /** 用户ID */
     @ApiModelProperty("用户ID")
     private Long userId;
+    /** 每场模考ID */
+    @ApiModelProperty("每场模考ID")
+    private Long eachExamId;
+
     /** 是否完成 1完成 0未完成 */
     @ApiModelProperty("是否完成 1完成 0未完成")
     private Integer status;

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserMockRecordEditBo.java

@@ -33,6 +33,9 @@ public class UserMockRecordEditBo {
     @ApiModelProperty("用户ID")
     private Long userId;
 
+    /** 每场模考ID */
+    @ApiModelProperty("每场模考ID")
+    private Long eachExamId;
 
     /** 是否完成 1完成 0未完成 */
     @ApiModelProperty("是否完成 1完成 0未完成")

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserMockRecordQueryBo.java

@@ -38,6 +38,9 @@ public class UserMockRecordQueryBo extends BaseEntity {
 	/** 用户ID */
 	@ApiModelProperty("用户ID")
 	private Long userId;
+	/** 每场模考ID */
+	@ApiModelProperty("每场模考ID")
+	private Long eachExamId;
 	/** 是否完成 1完成 0未完成 */
 	@ApiModelProperty("是否完成 1完成 0未完成")
 	private Integer status;

+ 3 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserMockWrongRecordAddBo.java

@@ -41,7 +41,7 @@ public class UserMockWrongRecordAddBo {
     /** 章卷ID */
     @ApiModelProperty("章卷ID")
     private Long chapterExamId;
-    /** 科目ID */
-    @ApiModelProperty("科目ID")
-    private Long subjectId;
+    /** 每场模考ID */
+    @ApiModelProperty("每场模考ID")
+    private Long eachExamId;
 }

+ 3 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserMockWrongRecordEditBo.java

@@ -44,7 +44,7 @@ public class UserMockWrongRecordEditBo {
     /** 章卷ID */
     @ApiModelProperty("章卷ID")
     private Long chapterExamId;
-    /** 科目ID */
-    @ApiModelProperty("科目ID")
-    private Long subjectId;
+    /** 每场模考ID */
+    @ApiModelProperty("每场模考ID")
+    private Long eachExamId;
 }

+ 3 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserMockWrongRecordQueryBo.java

@@ -50,7 +50,7 @@ public class UserMockWrongRecordQueryBo extends BaseEntity {
 
 	@ApiModelProperty("试卷类型ID")
 	private Integer paperId;
-	/** 科目ID */
-	@ApiModelProperty("科目ID")
-	private Long subjectId;
+	/** 每场模考ID */
+	@ApiModelProperty("每场模考ID")
+	private Long eachExamId;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserMockRecord.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
@@ -38,6 +39,8 @@ private static final long serialVersionUID=1L;
     private Long updateTime;
     /** 用户ID */
     private Long userId;
+    /** 每场模考ID */
+    private Long eachExamId;
     /** 是否完成 1完成 0未完成 */
     private Integer status;
     /** 1及格 0不及格 */

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserMockWrongRecord.java

@@ -46,6 +46,6 @@ private static final long serialVersionUID=1L;
     private Long moduleExamId;
     /** 章卷ID */
     private Long chapterExamId;
-    /** 科目ID */
-    private Long subjectId;
+    /** 每场模考ID */
+    private Long eachExamId;
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserMockWrongRecordServiceImpl.java

@@ -52,7 +52,7 @@ public class UserMockWrongRecordServiceImpl extends ServiceImpl<UserMockWrongRec
         lqw.eq(bo.getQuestionId() != null, UserMockWrongRecord::getQuestionId, bo.getQuestionId());
         lqw.eq(bo.getUserId() != null, UserMockWrongRecord::getUserId, bo.getUserId());
         lqw.eq(bo.getExamId() != null, UserMockWrongRecord::getExamId, bo.getExamId());
-        lqw.eq(bo.getSubjectId() != null, UserMockWrongRecord::getSubjectId, bo.getSubjectId());
+        lqw.eq(bo.getEachExamId() != null, UserMockWrongRecord::getEachExamId, bo.getEachExamId());
         return entity2Vo(this.list(lqw));
     }
 

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserMockRecordVo.java

@@ -109,4 +109,9 @@ public class UserMockRecordVo {
 	@ApiModelProperty("试卷总题数(含主观)")
 	private Long allQuestionNum;
 	private Long lessQuestionNum;
+
+	/** 每场模考ID */
+	@Excel(name = "每场模考ID")
+	@ApiModelProperty("每场模考ID")
+	private Long eachExamId;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserMockWrongRecordVo.java

@@ -117,4 +117,8 @@ public class UserMockWrongRecordVo {
 	@Excel(name = "章卷ID")
 	@ApiModelProperty("章卷ID")
 	private Long chapterExamId;
+	/** 每场模考ID */
+	@Excel(name = "每场模考ID")
+	@ApiModelProperty("每场模考ID")
+	private Long eachExamId;
 }

+ 15 - 13
zhongzheng-system/src/main/resources/mapper/modules/user/UserMockRecordMapper.xml

@@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="score" column="score"/>
         <result property="allQuestionNum" column="all_question_num"/>
         <result property="lessQuestionNum" column="less_question_num"/>
+        <result property="eachExamId" column="each_exam_id"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.user.vo.UserMockRecordVo" id="UserMockRecordVoResult">
@@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="examTime" column="exam_time"/>
         <result property="totalScore" column="total_score"/>
         <result property="score" column="score"/>
+        <result property="eachExamId" column="each_exam_id"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.user.vo.UserMockWrongRecordVo" id="UserMockRecordQuestionVoResult">
@@ -80,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="knowledgeIds" column="knowledge_ids"/>
         <result property="publishStatus" column="publish_status"/>
         <result property="code" column="code"/>
-
+        <result property="eachExamId" column="each_exam_id"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserMockRecordQueryBo" resultMap="UserMockRecordVoResult">
@@ -89,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             e.exam_name,
             ep.paper_name
         FROM
-            user_exam_record ue
+            user_mock_record ue
                 LEFT JOIN exam e ON ue.exam_id = e.exam_id
                 LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
         WHERE
@@ -122,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ue.chapter_exam_id,
         MAX( UE.record_id ) record_id
         FROM
-        user_exam_record ue
+        user_mock_record ue
         LEFT JOIN exam e ON ue.exam_id = e.exam_id
         LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
         WHERE
@@ -132,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ue.module_exam_id,
         ue.chapter_exam_id
         ) t
-        LEFT JOIN user_exam_record ue ON t.record_id = ue.record_id
+        LEFT JOIN user_mock_record ue ON t.record_id = ue.record_id
         LEFT JOIN exam e ON ue.exam_id = e.exam_id
         LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
         WHERE
@@ -155,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     e.exam_id,
                     q.*
                 FROM
-                    ( SELECT exam_id, group_concat( do_question_ids ) AS ids FROM user_exam_record WHERE user_id = #{userId} and do_question_ids is not null and `status` = 1 GROUP BY exam_id ) e
+                    ( SELECT exam_id, group_concat( do_question_ids ) AS ids FROM user_mock_record WHERE user_id = #{userId} and do_question_ids is not null and `status` = 1 GROUP BY exam_id ) e
                         LEFT JOIN question q ON FIND_IN_SET( q.question_id, e.ids )) AS eq
     </select>
 
@@ -170,9 +172,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 SELECT
                     group_concat( uer.right_question_ids ) AS ids
                 FROM
-                    user_exam_record uer
+                    user_mock_record uer
                 WHERE
-                        record_id IN ( SELECT MAX( record_id ) record_id FROM user_exam_record WHERE user_id = #{userId} and `status` = 1 GROUP BY exam_id )))
+                        record_id IN ( SELECT MAX( record_id ) record_id FROM user_mock_record WHERE user_id = #{userId} and `status` = 1 GROUP BY exam_id )))
 
     </select>
 
@@ -181,7 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             uer.*,
             e.exam_name
         FROM
-            user_exam_record uer
+            user_mock_record uer
                 LEFT JOIN exam e ON uer.exam_id = e.exam_id
         WHERE
             uer.record_id = #{recordId}
@@ -201,7 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
               FROM
                   exam_question eq
               WHERE
-                      eq.exam_id IN ( SELECT DISTINCT exam_id FROM user_exam_record WHERE user_id = #{userId})
+                      eq.exam_id IN ( SELECT DISTINCT exam_id FROM user_mock_record WHERE user_id = #{userId})
               GROUP BY
                   eq.exam_id ) uer
                 LEFT JOIN exam e ON e.exam_id = uer.exam_id
@@ -219,7 +221,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 SELECT
                     right_question_ids
                 FROM
-                    user_exam_record uer
+                    user_mock_record uer
                 WHERE
                     uer.user_id = #{userId}
                   AND uer.exam_id = #{examId}
@@ -237,9 +239,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 SELECT
                     question_id
                 FROM
-                    user_exam_wrong_record
+                    user_mock_wrong_record
                 WHERE
-                        record_id = ( SELECT record_id FROM user_exam_record uer WHERE uer.user_id = #{userId} AND uer.exam_id = #{examId} ORDER BY record_id DESC LIMIT 1 )) uewr
+                        record_id = ( SELECT record_id FROM user_mock_record uer WHERE uer.user_id = #{userId} AND uer.exam_id = #{examId} ORDER BY record_id DESC LIMIT 1 )) uewr
 	LEFT JOIN question q ON q.question_id = uewr.question_id
 
     </select>
@@ -255,7 +257,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 SELECT
                     GROUP_CONCAT( uer.do_question_ids )
                 FROM
-                    user_exam_record uer
+                    user_mock_record uer
                 WHERE
                     uer.user_id = #{userId}
                   AND uer.do_question_ids IS NOT NULL

+ 7 - 6
zhongzheng-system/src/main/resources/mapper/modules/user/UserMockWrongRecordMapper.xml

@@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime" column="update_time"/>
         <result property="moduleExamId" column="module_exam_id"/>
         <result property="chapterExamId" column="chapter_exam_id"/>
-        <result property="subjectId" column="subject_id"/>
+        <result property="eachExamId" column="each_exam_id"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.user.vo.UserMockWrongRecordVo" id="UserMockWrongRecordVoResult">
@@ -44,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="moduleExamId" column="module_exam_id"/>
         <result property="chapterExamId" column="chapter_exam_id"/>
         <result property="subjectId" column="subject_id"/>
+        <result property="eachExamId" column="each_exam_id"/>
     </resultMap>
 
 
@@ -54,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         e.exam_id,
         COUNT( DISTINCT uew.question_id ) AS wrong_question_num
         FROM
-        user_exam_wrong_record uew
+        user_mock_wrong_record uew
         LEFT JOIN exam e ON uew.exam_id = e.exam_id
         LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
         WHERE
@@ -73,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         q.*,
         uew.exam_id
         FROM
-        user_exam_wrong_record uew
+        user_mock_wrong_record uew
         LEFT JOIN question q ON q.question_id = uew.question_id
         WHERE
         uew.user_id = #{userId}
@@ -93,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             q.type,
             count(DISTINCT q.question_id ) AS num
         FROM
-                ( SELECT ue.* FROM user_exam_wrong_record ue
+                ( SELECT ue.* FROM user_mock_wrong_record ue
         LEFT JOIN exam e ON ue.exam_id = e.exam_id
         LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
                 WHERE user_id = #{userId}
@@ -110,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         q.*,
         uew.exam_id
         FROM
-        user_exam_wrong_record uew
+        user_mock_wrong_record uew
         LEFT JOIN question q ON uew.question_id = q.question_id
         WHERE
         1 = 1
@@ -129,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         exam_id,
         count( DISTINCT question_id ) AS num
         FROM
-        user_exam_wrong_record
+        user_mock_wrong_record
         WHERE
         1 = 1
         AND user_id = #{userId}