he2802 3 жил өмнө
parent
commit
ea600cca74

+ 69 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/user/UserExamRecordController.java

@@ -0,0 +1,69 @@
+package com.zhongzheng.controller.user;
+
+import com.zhongzheng.common.annotation.Log;
+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.user.bo.UserExamRecordAddBo;
+import com.zhongzheng.modules.user.bo.UserExamRecordEditBo;
+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 io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 用户的题库试卷做题历史Controller
+ *
+ * @author hjl
+ * @date 2021-12-15
+ */
+@Api(value = "用户的题库试卷做题历史控制器", tags = {"我的题库通-用户的题库试卷做题历史管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/exam/record")
+public class UserExamRecordController extends BaseController {
+
+    private final IUserExamRecordService iUserExamRecordService;
+
+
+
+    /**
+     * 查询用户的做题历史试卷列表
+     */
+    @ApiOperation("查询用户的做题历史试卷列表")
+    @GetMapping("/selectExamList")
+    public AjaxResult<List<UserExamRecordVo>> selectExamList(UserExamRecordQueryBo bo) {
+        List<UserExamRecordVo> list = iUserExamRecordService.selectExamList(bo);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 获取用户的题库试卷做题历史详细信息
+     */
+    @ApiOperation("获取用户的题库试卷做题历史详细信息")
+    @GetMapping("/{recordId}")
+    public AjaxResult<UserExamRecordVo> getInfo(@PathVariable("recordId" ) Long recordId) {
+        return AjaxResult.success(iUserExamRecordService.queryById(recordId));
+    }
+
+    /**
+     * 查询用户的题库试卷做题历史列表
+     */
+    @ApiOperation("查询用户的题库试卷做题历史列表")
+    @GetMapping("/list")
+    public TableDataInfo<UserExamRecordVo> list(UserExamRecordQueryBo bo) {
+        startPage();
+        List<UserExamRecordVo> list = iUserExamRecordService.selectList(bo);
+        return getDataTable(list);
+    }
+}

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

@@ -20,4 +20,5 @@ public interface UserExamRecordMapper extends BaseMapper<UserExamRecord> {
     Long selectDoNum(UserExamRecordQueryBo bo);
     Long selectRightNum(UserExamRecordQueryBo bo);
     UserExamRecordVo selectDetail(UserExamRecordQueryBo bo);
+    List<UserExamRecordVo> selectExamList(UserExamRecordQueryBo bo);
 }

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

@@ -25,6 +25,8 @@ public interface IUserExamRecordService extends IService<UserExamRecord> {
 
 	UserExamRecordVo selectDetail(UserExamRecordQueryBo bo);
 
+	List<UserExamRecordVo> selectExamList(UserExamRecordQueryBo bo);
+
 	/**
 	 * 查询列表
 	 */

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

@@ -46,6 +46,11 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
         return this.baseMapper.selectDetail(bo);
     }
 
+    @Override
+    public List<UserExamRecordVo> selectExamList(UserExamRecordQueryBo bo) {
+        return this.baseMapper.selectExamList(bo);
+    }
+
     @Override
     public List<UserExamRecordVo> queryList(UserExamRecordQueryBo bo) {
         LambdaQueryWrapper<UserExamRecord> lqw = Wrappers.lambdaQuery();

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

@@ -69,6 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="goodsId != null and goodsId != ''">
             AND ue.goods_id = #{goodsId}
         </if>
+        <if test="examId != null and examId != ''">
+            AND ue.exam_id = #{examId}
+        </if>
         ORDER by ue.record_id DESC
     </select>
 
@@ -118,4 +121,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND uer.user_id = #{userId}
 
     </select>
+
+    <select id="selectExamList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultMap="UserExamRecordVoResult">
+        SELECT
+            e.exam_id,
+            e.exam_name
+        FROM
+            exam e
+                LEFT JOIN ( SELECT exam_id FROM user_exam_record WHERE user_id = #{userId} GROUP BY exam_id ) uer ON e.exam_id = uer.exam_id
+
+
+    </select>
 </mapper>