he2802 3 년 전
부모
커밋
d0f0ec7092

+ 27 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserExamRecordController.java

@@ -11,6 +11,7 @@ import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.service.IUserExamRecordService;
 import com.zhongzheng.modules.user.vo.UserExamRecordVo;
+import com.zhongzheng.modules.user.vo.UserExamWrongRecordVo;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -132,4 +133,30 @@ public class UserExamRecordController extends BaseController {
     public AjaxResult<Void> remove(@PathVariable Long[] recordIds) {
         return toAjax(iUserExamRecordService.deleteWithValidByIds(Arrays.asList(recordIds), true) ? 1 : 0);
     }*/
+
+    /**
+     * 试卷详情做对题目列表
+     */
+    @ApiOperation("试卷详情做对题目列表")
+    @GetMapping("/right_list")
+    public TableDataInfo<UserExamWrongRecordVo> right_list(UserExamRecordQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<UserExamWrongRecordVo> list = iUserExamRecordService.getExamRecordRightList(bo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 试卷详情做错题目列表
+     */
+    @ApiOperation("试卷详情做错题目列表")
+    @GetMapping("/wrong_list")
+    public TableDataInfo<UserExamWrongRecordVo> wrong_list(UserExamRecordQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<UserExamWrongRecordVo> list = iUserExamRecordService.getExamRecordWrongList(bo);
+        return getDataTable(list);
+    }
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserExamRecordMapper.java

@@ -6,6 +6,7 @@ import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
 import com.zhongzheng.modules.user.domain.UserExamRecord;
 import com.zhongzheng.modules.user.vo.UserExamRecordVo;
+import com.zhongzheng.modules.user.vo.UserExamWrongRecordVo;
 
 import java.util.List;
 
@@ -21,4 +22,6 @@ public interface UserExamRecordMapper extends BaseMapper<UserExamRecord> {
     Long selectRightNum(UserExamRecordQueryBo bo);
     UserExamRecordVo selectDetail(UserExamRecordQueryBo bo);
     List<UserExamRecordVo> selectExamList(UserExamRecordQueryBo bo);
+    List<UserExamWrongRecordVo> getExamRecordRightList(UserExamRecordQueryBo bo);
+    List<UserExamWrongRecordVo> getExamRecordWrongList(UserExamRecordQueryBo bo);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserExamRecordService.java

@@ -6,6 +6,7 @@ import com.zhongzheng.modules.user.bo.UserExamRecordEditBo;
 import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
 import com.zhongzheng.modules.user.domain.UserExamRecord;
 import com.zhongzheng.modules.user.vo.UserExamRecordVo;
+import com.zhongzheng.modules.user.vo.UserExamWrongRecordVo;
 
 import java.util.Collection;
 import java.util.List;
@@ -27,6 +28,10 @@ public interface IUserExamRecordService extends IService<UserExamRecord> {
 
 	List<UserExamRecordVo> selectExamList(UserExamRecordQueryBo bo);
 
+	List<UserExamWrongRecordVo> getExamRecordRightList(UserExamRecordQueryBo bo);
+
+	List<UserExamWrongRecordVo> getExamRecordWrongList(UserExamRecordQueryBo bo);
+
 	/**
 	 * 查询列表
 	 */

+ 11 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamRecordServiceImpl.java

@@ -11,6 +11,7 @@ import com.zhongzheng.modules.user.mapper.UserExamRecordMapper;
 import com.zhongzheng.modules.user.mapper.UserSubscribeMapper;
 import com.zhongzheng.modules.user.service.IUserExamRecordService;
 import com.zhongzheng.modules.user.vo.UserExamRecordVo;
+import com.zhongzheng.modules.user.vo.UserExamWrongRecordVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -51,6 +52,16 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
         return this.baseMapper.selectExamList(bo);
     }
 
+    @Override
+    public List<UserExamWrongRecordVo> getExamRecordRightList(UserExamRecordQueryBo bo) {
+        return this.baseMapper.getExamRecordRightList(bo);
+    }
+
+    @Override
+    public List<UserExamWrongRecordVo> getExamRecordWrongList(UserExamRecordQueryBo bo) {
+        return this.baseMapper.getExamRecordWrongList(bo);
+    }
+
     @Override
     public List<UserExamRecordVo> queryList(UserExamRecordQueryBo bo) {
         LambdaQueryWrapper<UserExamRecord> lqw = Wrappers.lambdaQuery();

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamQuestionMapper.xml

@@ -137,4 +137,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             eq.id DESC
 
     </select>
+
+
 </mapper>

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

@@ -52,6 +52,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="totalScore" column="total_score"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.user.vo.UserExamWrongRecordVo" id="UserExamRecordQuestionVoResult">
+        <result property="wrongId" column="wrong_id"/>
+        <result property="recordId" column="record_id"/>
+        <result property="questionId" column="question_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="examId" column="exam_id"/>
+
+
+        <result property="examName" column="exam_name"/>
+        <result property="wrongQuestionNum" column="wrong_question_num"/>
+        <result property="type" column="type"/>
+        <result property="num" column="num"/>
+
+        <result property="content" column="content"/>
+        <result property="type" column="type"/>
+        <result property="answerQuestion" column="answer_question"/>
+        <result property="status" column="status"/>
+        <result property="analysisContent" column="analysis_content"/>
+        <result property="imgUrl" column="img_url"/>
+        <result property="jsonStr" column="json_str"/>
+        <result property="prefixName" column="prefix_name"/>
+        <result property="knowledgeIds" column="knowledge_ids"/>
+        <result property="publishStatus" column="publish_status"/>
+        <result property="code" column="code"/>
+    </resultMap>
+
     <select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultMap="UserExamRecordVoResult">
         SELECT
             ue.*,
@@ -132,4 +159,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN exam e ON e.exam_id = uer.exam_id
 
     </select>
+
+    <select id="getExamRecordRightList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultMap="UserExamRecordQuestionVoResult">
+        SELECT
+            *
+        FROM
+            question
+        WHERE
+            FIND_IN_SET(
+                    question_id,(
+                SELECT
+                    right_question_ids
+                FROM
+                    user_exam_record uer
+                WHERE
+                    uer.user_id = #{userId}
+                  AND uer.goods_id = #{goodsId}
+                  AND uer.exam_id = #{examId}
+                ORDER BY
+                    record_id DESC
+
+                LIMIT 1 ))
+
+    </select>
+
+    <select id="getExamRecordWrongList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultMap="UserExamRecordQuestionVoResult">
+        SELECT
+            q.*
+        FROM
+            (
+                SELECT
+                    question_id
+                FROM
+                    user_exam_wrong_record
+                WHERE
+                        record_id = ( SELECT record_id FROM user_exam_record uer WHERE uer.user_id = #{userId} AND uer.exam_id = #{examId} AND uer.goods_id = #{goodsId} ORDER BY record_id DESC LIMIT 1 )) uewr
+	LEFT JOIN question q ON q.question_id = uewr.question_id
+
+    </select>
 </mapper>