he2802 3 năm trước cách đây
mục cha
commit
f3c003536c

+ 22 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/bank/ExamController.java

@@ -5,13 +5,17 @@ import com.zhongzheng.common.core.controller.BaseController;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.framework.web.service.WxTokenService;
 import com.zhongzheng.modules.bank.bo.*;
 import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.zhongzheng.modules.bank.service.IExamQuestionService;
 import com.zhongzheng.modules.bank.service.IExamService;
 import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
+import com.zhongzheng.modules.bank.service.IQuestionChapterExamService;
 import com.zhongzheng.modules.bank.vo.ExamQuestionVo;
 import com.zhongzheng.modules.bank.vo.ExamVo;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
@@ -39,8 +43,15 @@ public class ExamController extends BaseController {
 
     private final IExamQuestionService iExamQuestionService;
 
+    private final IQuestionChapterExamService iQuestionChapterExamService;
 
 
+
+
+
+
+    private final WxTokenService wxTokenService;
+
     /**
      * 获取试卷详细信息
      */
@@ -50,6 +61,16 @@ public class ExamController extends BaseController {
         return AjaxResult.success(iExamService.queryById(examId));
     }
 
-
+    /**
+     * 查询关联试卷列表
+     */
+    @ApiOperation("查询章卷关联试卷列表")
+    @GetMapping("/exam/list")
+    public AjaxResult<List<ExamVo>> examList(QuestionChapterExamQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        List<ExamVo> list = iQuestionChapterExamService.getList(bo);
+        return AjaxResult.success(list);
+    }
 
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExamVo.java

@@ -143,4 +143,6 @@ public class ExamVo {
 
 	@ApiModelProperty("做的题目数")
 	private Long doQuestionNum;
+
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseUserMenuVo.java

@@ -79,4 +79,6 @@ public class CourseUserMenuVo {
 	@ApiModelProperty("章下面的节")
 	private List<CourseChapterSectionVo> courseChapterSectionList;
 
+
+
 }

+ 6 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsAttachedVo.java

@@ -55,8 +55,7 @@ public class GoodsAttachedVo {
 	@ApiModelProperty("历史记录ID")
 	private Integer recordId;
 
-	@ApiModelProperty("历史记录状态")
-	private Integer recordStatus;
+
 
 	@ApiModelProperty("总分")
 	private BigDecimal totalScore;
@@ -69,4 +68,9 @@ public class GoodsAttachedVo {
 
 	@ApiModelProperty("做的题目数")
 	private Long doQuestionNum;
+
+	@ApiModelProperty("历史记录状态 是否完成 1完成 0未完成")
+	private Integer recordStatus;
+
+	
 }

+ 10 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterExamMapper.xml

@@ -36,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="totalQuestionNum" column="total_question_num"/>
         <result property="rightQuestionNum" column="right_question_num"/>
         <result property="doQuestionNum" column="do_question_num"/>
+        <result property="recordStatus" column="record_status"/>
+        <result property="recordId" column="record_id"/>
     </resultMap>
 
     <select id="getList" parameterType="com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo" resultMap="QuestionChapterExamResultVo">
@@ -43,6 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             e.*,
             qce.sort AS exam_sort,
                3 as type
+        <if test="userId != null ">
+                ,
+            ifnull( (select `status` from user_exam_record uer where uer.exam_id = e.exam_id and uer.user_id = #{userId} ORDER BY uer.record_id desc limit 1),-1) record_status
+            ,
+            ifnull( (select record_id from user_exam_record uer where uer.exam_id = e.exam_id and uer.user_id = #{userId} ORDER BY uer.record_id desc limit 1),-1) record_id
+        </if>
         FROM
             question_chapter_exam qce
                 LEFT JOIN (
@@ -55,9 +63,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 GROUP BY
                     e.exam_id
             ) e ON qce.exam_id = e.exam_id
+
         WHERE
             qce.chapter_exam_id =#{chapterExamId}
           AND e.status = 1
+
     </select>
 
     <select id="getDoList" parameterType="com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo" resultMap="QuestionChapterExamResultVo">

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuMapper.xml

@@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="liveStartTime" column="live_start_time"/>
         <result property="liveEndTime" column="live_end_time"/>
         <result property="recordingUrl" column="recording_url"/>
+
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo"  resultMap="CourseMenuResultVo">

+ 22 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

@@ -29,6 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="totalQuestionNum" column="total_question_num"/>
 		<result property="rightQuestionNum" column="right_question_num"/>
 		<result property="doQuestionNum" column="do_question_num"/>
+		<result property="recordStatus" column="record_status"/>
+		<result property="recordId" column="record_id"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo" resultMap="GoodsAttachedResultVo">
@@ -70,6 +72,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				WHEN ga.type = 3 THEN
 					e.publish_status
 				END publish_status
+			<if test="userId != null ">
+				,
+				CASE
+				WHEN ga.type = 1 THEN
+				-1
+				WHEN ga.type = 2 THEN
+				-1
+				WHEN ga.type = 3 THEN
+				ifnull( (select `status` from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} ORDER BY uer.record_id desc limit 1),-1)
+				END record_status
+				,
+				CASE
+				WHEN ga.type = 1 THEN
+				-1
+				WHEN ga.type = 2 THEN
+				-1
+				WHEN ga.type = 3 THEN
+				ifnull( (select record_id from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} ORDER BY uer.record_id desc limit 1),-1)
+				END record_id
+			</if>
 		FROM
 			goods_attached ga
 				LEFT JOIN question_module qm ON ga.major_id = qm.module_exam_id