Przeglądaj źródła

报告错误数

he2802 4 lat temu
rodzic
commit
036cc020c0

+ 11 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserExamWrongRecordController.java

@@ -116,6 +116,17 @@ public class UserExamWrongRecordController extends BaseController {
         return AjaxResult.success(iUserExamWrongRecordService.queryById(wrongId));
     }
 
+
+    @ApiOperation("获取用户报告错题数")
+    @GetMapping("/wrongNum/{recordId}")
+    public AjaxResult<Long> wrongNum(@PathVariable("recordId" ) Long recordId) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        UserExamWrongRecordQueryBo wBo = new UserExamWrongRecordQueryBo();
+        wBo.setRecordId(recordId);
+        wBo.setUserId(loginUser.getUser().getUserId());
+        return AjaxResult.success(iUserExamWrongRecordService.recordNum(wBo));
+    }
+
     /**
      * 新增用户我的题库错题记录
      */

+ 7 - 3
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -135,9 +135,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         count( DISTINCT question_id )
         FROM
         user_exam_wrong_record
-        WHERE
-        goods_id = #{goodsId}
+        WHERE 1=1
+        <if test="goodsId != null and goodsId != ''">
+        AND goods_id = #{goodsId}
+        </if>
         AND user_id = #{userId}
-
+        <if test="recordId != null and recordId != ''">
+            AND record_id = #{recordId}
+        </if>
     </select>
 </mapper>