Browse Source

submit:V1.0.01版

yangdamao 3 years ago
parent
commit
b03b281348
19 changed files with 400 additions and 28 deletions
  1. 13 0
      zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserBankRecordController.java
  2. 3 5
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/SmsUtils.java
  3. 0 6
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CourseTopicGoods.java
  4. 4 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseTopicServiceImpl.java
  5. 39 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserBankRecordAddBo.java
  6. 39 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserBankRecordEditBo.java
  7. 18 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserExamWrongRecordAddBo.java
  8. 28 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserBankRecord.java
  9. 12 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserExamWrongRecord.java
  10. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserBankRecordMapper.java
  11. 9 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserBankRecordService.java
  12. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserBankRecordServiceImpl.java
  13. 2 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamWrongRecordServiceImpl.java
  14. 40 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserBankRecordVo.java
  15. 14 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserExamRecordVo.java
  16. 18 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserExamWrongRecordVo.java
  17. 1 1
      zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml
  18. 36 1
      zhongzheng-system/src/main/resources/mapper/modules/user/UserBankRecordMapper.xml
  19. 114 9
      zhongzheng-system/src/main/resources/mapper/modules/user/UserExamRecordMapper.xml

+ 13 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserBankRecordController.java

@@ -64,6 +64,19 @@ public class UserBankRecordController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询用户的做题历史列表
+     */
+    @ApiOperation("视频商品查询用户的做题历史列表")
+    @GetMapping("/bankList")
+    public TableDataInfo<UserBankRecordVo> getUserBankList(UserBankRecordQueryBo bo) {
+        startPage();
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        List<UserBankRecordVo> list = iUserBankRecordService.getUserBankList(bo);
+        return getDataTable(list);
+    }
+
     /**
      * 修改用户的做题历史
      */

+ 3 - 5
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/SmsUtils.java

@@ -1,10 +1,8 @@
 package com.zhongzheng.common.utils;
 
-import com.aliyun.tea.*;
-import com.aliyun.dysmsapi20170525.*;
-import com.aliyun.dysmsapi20170525.models.*;
-import com.aliyun.teaopenapi.*;
-import com.aliyun.teaopenapi.models.*;
+import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
+import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
+import com.aliyun.teaopenapi.models.Config;
 
 public class SmsUtils {
     //产品名称:云通信短信API产品,开发者无需替换

+ 0 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CourseTopicGoods.java

@@ -36,12 +36,6 @@ private static final long serialVersionUID=1L;
     private Long goodsId;
     /** 商品名称 */
     private String goodsName;
-    /** 标准价格 */
-    private BigDecimal standPrice;
-    /** 最低价格 */
-    private BigDecimal lowestPrice;
-    /** 商品划线价 */
-    private BigDecimal linePrice;
     /** 1有效 0无效 */
     private Integer status;
     /** 创建时间 */

+ 4 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseTopicServiceImpl.java

@@ -164,10 +164,6 @@ public class CourseTopicServiceImpl extends ServiceImpl<CourseTopicMapper, Cours
         List<CourseTopicGoods> goodsList = bo.stream().map(item -> {
             CourseTopicGoods tbTopic = new CourseTopicGoods();
             BeanUtil.copyProperties(item, tbTopic);
-            Goods goods = iGoodsService.getById(item.getGoodsId());
-            tbTopic.setStandPrice(goods.getStandPrice());
-            tbTopic.setLowestPrice(goods.getLowestPrice());
-            tbTopic.setLinePrice(goods.getLinePrice());
             tbTopic.setStatus(1);
             tbTopic.setUpdateTime(DateUtils.getNowTime());
             tbTopic.setCreateTime(DateUtils.getNowTime());
@@ -206,6 +202,10 @@ public class CourseTopicServiceImpl extends ServiceImpl<CourseTopicMapper, Cours
         return list.stream().map(item ->{
             CourseTopicGoodsVo vo = new CourseTopicGoodsVo();
             BeanUtil.copyProperties(item, vo);
+            Goods goods = iGoodsService.getById(item.getGoodsId());
+            vo.setLinePrice(goods.getLinePrice());
+            vo.setLowestPrice(goods.getLowestPrice());
+            vo.setStandPrice(goods.getStandPrice());
             return vo;
         }).collect(Collectors.toList());
     }

+ 39 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserBankRecordAddBo.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.apache.poi.hpsf.Decimal;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -42,6 +43,8 @@ public class UserBankRecordAddBo {
     /** 试卷绑定的商品 */
     @ApiModelProperty("试卷绑定的商品")
     private Long goodsId;
+    @ApiModelProperty("订单商品ID")
+    private Long orderGoodsId;
     /** 1及格 0不及格 */
     @ApiModelProperty("1及格 0不及格")
     private Integer reportStatus;
@@ -78,4 +81,40 @@ public class UserBankRecordAddBo {
     /** 相似度 */
     @ApiModelProperty("相似度")
     private Integer similarity;
+    /** 历史做题JSON */
+    @ApiModelProperty("历史做题JSON")
+    private String historyExamJson;
+    /** 试卷总题数(不含主观) */
+    @ApiModelProperty("试卷总题数(不含主观)")
+    private Integer totalQuestionNum;
+    /** 做对总题数 */
+    @ApiModelProperty("做对总题数")
+    private Integer rightQuestionNum;
+    /** 做的题目数(含主观题) */
+    @ApiModelProperty("做的题目数(含主观题)")
+    private Integer doQuestionNum;
+    /** 做题时长(秒数) */
+    @ApiModelProperty("做题时长(秒数)")
+    private Integer doTime;
+    /** 试卷总做题时长(秒数) */
+    @ApiModelProperty("试卷总做题时长(秒数)")
+    private Integer examTime;
+    /** 总分 */
+    @ApiModelProperty("总分")
+    private Decimal totalScore;
+    /** 做的题目id拼接 */
+    @ApiModelProperty("做的题目id拼接")
+    private String doQuestionIds;
+    /** 做对总题目id拼接 */
+    @ApiModelProperty("做对总题目id拼接")
+    private String rightQuestionIds;
+    /** 主观题得分 */
+    @ApiModelProperty("主观题得分")
+    private Decimal score;
+    /** 试卷总题数(含主观) */
+    @ApiModelProperty("试卷总题数(含主观)")
+    private Integer allQuestionNum;
+    /** 少做题数 */
+    @ApiModelProperty("少做题数")
+    private Integer lessQuestionNum;
 }

+ 39 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserBankRecordEditBo.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.apache.poi.hpsf.Decimal;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -45,6 +46,8 @@ public class UserBankRecordEditBo {
     /** 试卷绑定的商品 */
     @ApiModelProperty("试卷绑定的商品")
     private Long goodsId;
+    @ApiModelProperty("订单商品ID")
+    private Long orderGoodsId;
     /** 1及格 0不及格 */
     @ApiModelProperty("1及格 0不及格")
     private Integer reportStatus;
@@ -81,4 +84,40 @@ public class UserBankRecordEditBo {
     /** 相似度 */
     @ApiModelProperty("相似度")
     private Integer similarity;
+    /** 历史做题JSON */
+    @ApiModelProperty("历史做题JSON")
+    private String historyExamJson;
+    /** 试卷总题数(不含主观) */
+    @ApiModelProperty("试卷总题数(不含主观)")
+    private Integer totalQuestionNum;
+    /** 做对总题数 */
+    @ApiModelProperty("做对总题数")
+    private Integer rightQuestionNum;
+    /** 做的题目数(含主观题) */
+    @ApiModelProperty("做的题目数(含主观题)")
+    private Integer doQuestionNum;
+    /** 做题时长(秒数) */
+    @ApiModelProperty("做题时长(秒数)")
+    private Integer doTime;
+    /** 试卷总做题时长(秒数) */
+    @ApiModelProperty("试卷总做题时长(秒数)")
+    private Integer examTime;
+    /** 总分 */
+    @ApiModelProperty("总分")
+    private BigDecimal totalScore;
+    /** 做的题目id拼接 */
+    @ApiModelProperty("做的题目id拼接")
+    private String doQuestionIds;
+    /** 做对总题目id拼接 */
+    @ApiModelProperty("做对总题目id拼接")
+    private String rightQuestionIds;
+    /** 主观题得分 */
+    @ApiModelProperty("主观题得分")
+    private BigDecimal score;
+    /** 试卷总题数(含主观) */
+    @ApiModelProperty("试卷总题数(含主观)")
+    private Integer allQuestionNum;
+    /** 少做题数 */
+    @ApiModelProperty("少做题数")
+    private Integer lessQuestionNum;
 }

+ 18 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserExamWrongRecordAddBo.java

@@ -48,4 +48,22 @@ public class UserExamWrongRecordAddBo {
     /** 订单商品ID */
     @ApiModelProperty("订单商品ID")
     private Long orderGoodsId;
+    /** 类型1,题库 2,视频 */
+    @ApiModelProperty("类型1,题库 2,视频 ")
+    private Integer courseType;
+    /** 绑定课程 */
+    @ApiModelProperty("绑定课程")
+    private Long courseId;
+    /** 节ID */
+    @ApiModelProperty("节ID")
+    private Long sectionId;
+    /** 模块ID */
+    @ApiModelProperty("模块ID")
+    private Long moduleId;
+    /** 章ID */
+    @ApiModelProperty("章ID")
+    private Long chapterId;
+    /** 班级ID */
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
 }

+ 28 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserBankRecord.java

@@ -9,6 +9,7 @@ import java.io.Serializable;
 import java.util.Date;
 import java.math.BigDecimal;
 import com.zhongzheng.common.annotation.Excel;
+import org.apache.poi.hpsf.Decimal;
 
 /**
  * 用户的做题历史对象 user_bank_record
@@ -45,6 +46,8 @@ private static final long serialVersionUID=1L;
     private Integer status;
     /** 试卷绑定的商品 */
     private Long goodsId;
+    /** 试卷绑定的商品 */
+    private Long orderGoodsId;
     /** 1及格 0不及格 */
     private Integer reportStatus;
     /** 绑定课程 */
@@ -68,4 +71,29 @@ private static final long serialVersionUID=1L;
     private Integer type;
     /** 访问IP */
     private String ip;
+    /** 历史做题JSON */
+    private String historyExamJson;
+    /** 试卷总题数(不含主观) */
+    private Integer totalQuestionNum;
+    /** 做对总题数 */
+    private Integer rightQuestionNum;
+    /** 做的题目数(含主观题) */
+    private Integer doQuestionNum;
+    /** 做题时长(秒数) */
+    private Integer doTime;
+    /** 试卷总做题时长(秒数) */
+    private Integer examTime;
+    /** 总分 */
+    private BigDecimal totalScore;
+    /** 做的题目id拼接 */
+    private String doQuestionIds;
+    /** 做对总题目id拼接 */
+    private String rightQuestionIds;
+    /** 主观题得分 */
+    private BigDecimal score;
+    /** 试卷总题数(含主观) */
+    private Integer allQuestionNum;
+    /** 少做题数 */
+    private Integer lessQuestionNum;
+
 }

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserExamWrongRecord.java

@@ -48,4 +48,16 @@ private static final long serialVersionUID=1L;
     private Long chapterExamId;
     /** 订单商品ID */
     private Long orderGoodsId;
+    /** 类型1,题库 2,视频 */
+    private Integer courseType;
+    /** 绑定课程 */
+    private Long courseId;
+    /** 节ID */
+    private Long sectionId;
+    /** 模块ID */
+    private Long moduleId;
+    /** 章ID */
+    private Long chapterId;
+    /** 班级ID */
+    private Long gradeId;
 }

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.user.bo.UserBankRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserCourseAnswerQueryBo;
 import com.zhongzheng.modules.user.domain.UserBankRecord;
+import com.zhongzheng.modules.user.vo.UserBankRecordVo;
 import com.zhongzheng.modules.user.vo.UserCourseAnswerVo;
 
 import java.util.List;
@@ -16,4 +17,6 @@ import java.util.List;
  */
 public interface UserBankRecordMapper extends BaseMapper<UserBankRecord> {
     Long getUserExamDoNum(UserBankRecordQueryBo bo);
+
+    List<UserBankRecordVo> getUserBankList(UserBankRecordQueryBo bo);
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserBankRecordService.java

@@ -51,4 +51,13 @@ public interface IUserBankRecordService extends IService<UserBankRecord> {
 	 * @return
 	 */
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+	/**
+	 * 查询用户的做题历史列表
+	 * @author change
+	 * @date 2022/10/20 11:13
+	 * @param bo
+	 * @return java.util.List<com.zhongzheng.modules.user.vo.UserBankRecordVo>
+	 */
+    List<UserBankRecordVo> getUserBankList(UserBankRecordQueryBo bo);
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserBankRecordServiceImpl.java

@@ -130,6 +130,7 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
     public Long insertByAddBo(UserBankRecordAddBo bo) {
         UserBankRecord add = BeanUtil.toBean(bo, UserBankRecord.class);
         validEntityBeforeSave(add);
+        add.setStatus(1);
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
         add.setIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
@@ -162,6 +163,7 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
     public Boolean updateByEditBo(UserBankRecordEditBo bo) {
         UserBankRecord update = BeanUtil.toBean(bo, UserBankRecord.class);
         validEntityBeforeSave(update);
+        update.setStatus(1);
         update.setUpdateTime(DateUtils.getNowTime());
         boolean b = this.updateById(update);
         UserBankRecordVo userBankRecordVo = this.queryById(update.getRecordId());
@@ -262,6 +264,11 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
         return this.removeByIds(ids);
     }
 
+    @Override
+    public List<UserBankRecordVo> getUserBankList(UserBankRecordQueryBo bo) {
+        return baseMapper.getUserBankList(bo);
+    }
+
 
     //获得今天时间的0点
     public static int getTimesmorning(){

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

@@ -105,7 +105,8 @@ public class UserExamWrongRecordServiceImpl extends ServiceImpl<UserExamWrongRec
     @Override
     public Boolean insertByAddBo(UserExamWrongRecordAddBo bo) {
         if(bo.getQuestionIds()==null||bo.getQuestionIds().size()==0){
-            throw new CustomException("题目数组错误");
+//            throw new CustomException("题目数组错误");
+            return false;
         }
         if(Validator.isEmpty(bo.getOrderGoodsId())){
             throw new CustomException("缺失订单商品ID");

+ 40 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserBankRecordVo.java

@@ -96,5 +96,45 @@ public class UserBankRecordVo {
 	@Excel(name = "访问IP")
 	@ApiModelProperty("访问IP")
 	private String ip;
+	/** 历史做题JSON */
+	@ApiModelProperty("历史做题JSON")
+	private String historyExamJson;
+	/** 试卷总题数(不含主观) */
+	@ApiModelProperty("试卷总题数(不含主观)")
+	private Integer totalQuestionNum;
+	/** 做对总题数 */
+	@ApiModelProperty("做对总题数")
+	private Integer rightQuestionNum;
+	/** 做的题目数(含主观题) */
+	@ApiModelProperty("做的题目数(含主观题)")
+	private Integer doQuestionNum;
+	/** 做题时长(秒数) */
+	@ApiModelProperty("做题时长(秒数)")
+	private Integer doTime;
+	/** 试卷总做题时长(秒数) */
+	@ApiModelProperty("试卷总做题时长(秒数)")
+	private Integer examTime;
+	/** 总分 */
+	@ApiModelProperty("总分")
+	private BigDecimal totalScore;
+	/** 做的题目id拼接 */
+	@ApiModelProperty("做的题目id拼接")
+	private String doQuestionIds;
+	/** 做对总题目id拼接 */
+	@ApiModelProperty("做对总题目id拼接")
+	private String rightQuestionIds;
+	/** 主观题得分 */
+	@ApiModelProperty("主观题得分")
+	private BigDecimal score;
+	/** 试卷总题数(含主观) */
+	@ApiModelProperty("试卷总题数(含主观)")
+	private Integer allQuestionNum;
+	/** 少做题数 */
+	@ApiModelProperty("少做题数")
+	private Integer lessQuestionNum;
+	@ApiModelProperty("试卷名")
+	private String examName;
 
+	@ApiModelProperty("试卷类型")
+	private String paperName;
 }

+ 14 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserExamRecordVo.java

@@ -27,7 +27,10 @@ public class UserExamRecordVo {
 	/** $pkColumn.columnComment */
 	@ApiModelProperty("$pkColumn.columnComment")
 	private Long recordId;
-
+	@ApiModelProperty("题卷类型 1章卷 2节卷 3模块卷")
+	private Integer type;
+	@ApiModelProperty("1,题库商品 2,视频商品")
+	private Integer courseType;
 	/** 试卷ID */
 	@Excel(name = "试卷ID")
 	@ApiModelProperty("试卷ID")
@@ -83,6 +86,16 @@ public class UserExamRecordVo {
 	@Excel(name = "模块卷ID")
 	@ApiModelProperty("模块卷ID")
 	private Long moduleExamId;
+	@ApiModelProperty("课程ID")
+	private Long courseId;
+	@ApiModelProperty("模块ID")
+	private Long moduleId;
+	@ApiModelProperty("章IC")
+	private Long chapterId;
+	@ApiModelProperty("节IC")
+	private Long sectionId;
+	@ApiModelProperty("班级ID")
+	private Long gradeId;
 	/** 章卷ID */
 	@Excel(name = "章卷ID")
 	@ApiModelProperty("章卷ID")

+ 18 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserExamWrongRecordVo.java

@@ -128,4 +128,22 @@ public class UserExamWrongRecordVo {
 	@Excel(name = "订单商品ID")
 	@ApiModelProperty("订单商品ID")
 	private Long orderGoodsId;
+	/** 类型1,题库 2,视频 */
+	@ApiModelProperty("类型1,题库 2,视频 ")
+	private Integer courseType;
+	/** 绑定课程 */
+	@ApiModelProperty("绑定课程")
+	private Long courseId;
+	/** 节ID */
+	@ApiModelProperty("节ID")
+	private Long sectionId;
+	/** 模块ID */
+	@ApiModelProperty("模块ID")
+	private Long moduleId;
+	/** 章ID */
+	@ApiModelProperty("章ID")
+	private Long chapterId;
+	/** 班级ID */
+	@ApiModelProperty("班级ID")
+	private Long gradeId;
 }

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -314,7 +314,7 @@
                 LEFT JOIN `order` o on o.order_sn = og.order_sn
         WHERE
             1 = 1
-          AND g.goods_type = 2
+          AND g.goods_type in (1,2)
           AND o.user_id=#{userId}
           AND og.`status` =1
           and og.pay_status in (2,3,4)

+ 36 - 1
zhongzheng-system/src/main/resources/mapper/modules/user/UserBankRecordMapper.xml

@@ -49,9 +49,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="rightRate" column="right_rate"/>
     </resultMap>
 
+    <select id="getUserBankList" parameterType="com.zhongzheng.modules.user.bo.UserBankRecordQueryBo" resultType="com.zhongzheng.modules.user.vo.UserBankRecordVo">
+        SELECT
+        ue.*,
+        e.exam_name,
+        ep.paper_name
+        FROM
+        user_bank_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
+        ue.user_id = #{userId}
+        <if test="gradeId != null and gradeId != ''">
+            AND ue.grade_id = #{gradeId}
+        </if>
+        <if test="goodsId != null and goodsId != ''">
+            AND ue.goods_id = #{goodsId}
+        </if>
+        <if test="examId != null and examId != ''">
+            AND ue.exam_id = #{examId}
+        </if>
+        <if test="courseId != null and courseId != ''">
+            AND ue.course_id = #{courseId}
+        </if>
+        <if test="sectionId != null and sectionId != ''">
+            AND ue.section_id = #{sectionId}
+        </if>
+        <if test="moduleId != null and moduleId != ''">
+            AND ue.module_id = #{moduleId}
+        </if>
+        <if test="chapterId != null and chapterId != ''">
+            AND ue.chapter_id = #{chapterId}
+        </if>
+        ORDER by ue.create_time DESC
+    </select>
+
     <select id="getUserExamDoNum" parameterType="com.zhongzheng.modules.user.bo.UserBankRecordQueryBo" resultType="Long">
         SELECT
-            IFNULL(count(*),0)
+        IFNULL(count(*),0)
         FROM
         user_bank_record ubr
         WHERE

+ 114 - 9
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamRecordMapper.xml

@@ -122,11 +122,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER by ue.record_id DESC
     </select>
 
-    <select id="selectGroupList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultMap="UserExamRecordVoResult">
+    <select id="selectGroupList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="com.zhongzheng.modules.user.vo.UserExamRecordVo">
+        SELECT * FROM (
         SELECT
-        ue.*,
-        e.exam_name,
-        ep.paper_name
+        ue.record_id ,ue.user_id ,ue.exam_id ,1 AS courseType,null as type,ue.`status`,ue.goods_id
+        ,ue.report_status,ue.performance,ue.history_exam_json,
+        ue.update_time,ue.total_question_num,ue.right_question_num,ue.do_question_num,ue.module_exam_id as moduleExamId,
+        ue.chapter_exam_id as chapterExamId,NULL as courseId,NULL as moduleId,NULL as chapterId,NULL as sectionId,NULL
+        as gradeId,
+        ue.do_time,ue.exam_time,ue.total_score,ue.do_question_ids,ue.right_question_ids,ue.score,ue.all_question_num,ue.order_goods_id,
+        ue.less_question_num,ue.create_time,e.exam_name,ep.paper_name
         FROM
         (
         SELECT
@@ -162,15 +167,115 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="examId != null and examId != ''">
             AND ue.exam_id = #{examId}
         </if>
-        <if test="educationTypeId != null and educationTypeId != ''">
-            AND g.education_type_id = #{educationTypeId}
+        <if test="moduleExamId != null and moduleExamId != ''">
+            AND ue.module_exam_id = #{moduleExamId}
         </if>
-        <if test="businessId != null and businessId != ''">
-            AND g.business_id = #{businessId}
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND ue.order_goods_id = #{orderGoodsId}
         </if>
-        ORDER by ue.record_id DESC
+        <if test="chapterExamId != null and chapterExamId != ''">
+            AND ue.chapter_exam_id = #{chapterExamId}</if>-- ORDER by ue.record_id DESC
+        UNION ALL
+        SELECT
+        ue.record_id,ue.user_id ,ue.exam_id,2 AS courseType,ue.type,ue.`status` ,ue.goods_id ,ue.
+        report_status,ue.performance,ue.history_exam_json,
+        ue.update_time,ue.total_question_num,ue.right_question_num,ue.do_question_num,NULL as moduleExamId,NULL as
+        chapterExamId,
+        ue.course_id as courseId,ue.module_id as moduleId,ue.chapter_id as chapterId,ue.section_id as
+        sectionId,ue.grade_id as gradeId,
+        ue.do_time,ue.exam_time,ue.total_score,ue.do_question_ids,ue.right_question_ids,ue.score,ue.all_question_num,ue.order_goods_id,
+        ue.less_question_num,ue.create_time,e.exam_name,ep.paper_name
+        FROM
+        (
+        SELECT
+        ue.goods_id,
+        ue.exam_id,
+        MAX( ue.record_id ) record_id
+        FROM
+        user_bank_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
+        ue.user_id = #{userId}
+        GROUP BY
+        ue.goods_id,
+        ue.exam_id,
+        ue.course_id,
+        ue.module_id,
+        ue.chapter_id,
+        ue.section_id
+        ) t
+        LEFT JOIN user_bank_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
+        LEFT JOIN goods g ON g.goods_id = ue.goods_id
+        WHERE
+        ue.user_id = #{userId}
+        <if test="paperId != null and paperId != ''">
+            AND ep.paper_id = #{paperId}
+        </if>
+        <if test="goodsId != null and goodsId != ''">
+            AND ue.goods_id = #{goodsId}
+        </if>
+        <if test="examId != null and examId != ''">
+            AND ue.exam_id = #{examId}
+        </if>
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND ue.order_goods_id = #{orderGoodsId}
+        </if>
+        ) a ORDER by a.create_time DESC
+        -- ORDER by ue.record_id DESC
     </select>
 
+<!--    <select id="selectGroupList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultMap="UserExamRecordVoResult">-->
+<!--        SELECT-->
+<!--        ue.*,-->
+<!--        e.exam_name,-->
+<!--        ep.paper_name-->
+<!--        FROM-->
+<!--        (-->
+<!--        SELECT-->
+<!--        ue.goods_id,-->
+<!--        ue.exam_id,-->
+<!--        ue.module_exam_id,-->
+<!--        ue.chapter_exam_id,-->
+<!--        MAX( UE.record_id ) record_id-->
+<!--        FROM-->
+<!--        user_exam_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-->
+<!--        ue.user_id = #{userId}-->
+<!--        GROUP BY-->
+<!--        ue.goods_id,-->
+<!--        ue.exam_id,-->
+<!--        ue.module_exam_id,-->
+<!--        ue.chapter_exam_id-->
+<!--        ) t-->
+<!--        LEFT JOIN user_exam_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-->
+<!--        LEFT JOIN goods g ON g.goods_id = ue.goods_id-->
+<!--        WHERE-->
+<!--        ue.user_id = #{userId}-->
+<!--        <if test="paperId != null and paperId != ''">-->
+<!--            AND ep.paper_id = #{paperId}-->
+<!--        </if>-->
+<!--        <if test="goodsId != null and goodsId != ''">-->
+<!--            AND ue.goods_id = #{goodsId}-->
+<!--        </if>-->
+<!--        <if test="examId != null and examId != ''">-->
+<!--            AND ue.exam_id = #{examId}-->
+<!--        </if>-->
+<!--        <if test="educationTypeId != null and educationTypeId != ''">-->
+<!--            AND g.education_type_id = #{educationTypeId}-->
+<!--        </if>-->
+<!--        <if test="businessId != null and businessId != ''">-->
+<!--            AND g.business_id = #{businessId}-->
+<!--        </if>-->
+<!--        ORDER by ue.record_id DESC-->
+<!--    </select>-->
+
     <select id="selectDoNum" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="Long">
         SELECT
             IFNULL( COUNT(*), 0 ) num