Parcourir la source

Merge remote-tracking branch 'origin/master'

Althars123 il y a 2 ans
Parent
commit
4d810d34ba
20 fichiers modifiés avec 704 ajouts et 170 suppressions
  1. 22 14
      jpcj-admin/src/main/java/com/miaxis/app/controller/common/CommonQuestionInfoController.java
  2. 13 0
      jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionCollectionController.java
  3. 15 13
      jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionInfoController.java
  4. 15 0
      jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionWrongController.java
  5. 26 10
      jpcj-service/src/main/java/com/miaxis/question/domain/QuestionInfo.java
  6. 89 0
      jpcj-service/src/main/java/com/miaxis/question/domain/TAppExamRule.java
  7. 27 0
      jpcj-service/src/main/java/com/miaxis/question/dto/QuestionCollectionDelDTO.java
  8. 17 8
      jpcj-service/src/main/java/com/miaxis/question/dto/QuestionInfoDTO.java
  9. 0 6
      jpcj-service/src/main/java/com/miaxis/question/dto/QuestionInfoFreeDTO.java
  10. 29 0
      jpcj-service/src/main/java/com/miaxis/question/dto/QuestionInfoMiDTO.java
  11. 17 7
      jpcj-service/src/main/java/com/miaxis/question/dto/QuestionInfoTestDTO.java
  12. 27 0
      jpcj-service/src/main/java/com/miaxis/question/dto/QuestionWrongDelDTO.java
  13. 4 0
      jpcj-service/src/main/java/com/miaxis/question/mapper/QuestionInfoMapper.java
  14. 23 0
      jpcj-service/src/main/java/com/miaxis/question/mapper/TAppExamRuleMapper.java
  15. 4 3
      jpcj-service/src/main/java/com/miaxis/question/service/IQuestionInfoService.java
  16. 22 0
      jpcj-service/src/main/java/com/miaxis/question/service/ITAppExamRuleService.java
  17. 197 100
      jpcj-service/src/main/java/com/miaxis/question/service/impl/QuestionInfoServiceImpl.java
  18. 34 0
      jpcj-service/src/main/java/com/miaxis/question/service/impl/TAppExamRuleServiceImpl.java
  19. 82 9
      jpcj-service/src/main/resources/mapper/question/QuestionInfoMapper.xml
  20. 41 0
      jpcj-service/src/main/resources/mapper/rule/TAppExamRuleMapper.xml

+ 22 - 14
jpcj-admin/src/main/java/com/miaxis/app/controller/common/CommonQuestionInfoController.java

@@ -2,20 +2,18 @@ package com.miaxis.app.controller.common;
 
 import com.miaxis.common.constant.Constants;
 import com.miaxis.common.core.controller.BaseController;
-import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.core.page.ResponsePageInfo;
 import com.miaxis.question.domain.QuestionInfo;
-import com.miaxis.question.dto.QuestionInfoDTO;
-import com.miaxis.question.dto.QuestionInfoFlDTO;
+import com.miaxis.question.dto.QuestionInfoFreeDTO;
 import com.miaxis.question.dto.QuestionInfoTestDTO;
 import com.miaxis.question.service.IQuestionInfoService;
-import com.miaxis.question.vo.QuestionInfoDfVO;
-import com.miaxis.question.vo.QuestionInfoFlVO;
-import com.miaxis.question.vo.QuestionInfoJxVO;
-import com.miaxis.question.vo.QuestionInfoSxVO;
-import io.swagger.annotations.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 
@@ -33,12 +31,22 @@ public class CommonQuestionInfoController extends BaseController{
     private IQuestionInfoService questionInfoService;
 
     /**
-     * 查询模拟考试题库
+     * 查询模拟考试科目1与4题库
      */
-    @GetMapping("/selectTestQuestionInfo")
-    @ApiOperation("查询模拟考试题库")
-    public ResponsePageInfo<QuestionInfo> selectTestQuestionInfo(@ModelAttribute QuestionInfoTestDTO questionInfoTestDTO){
-        List<QuestionInfo> list = questionInfoService.selectTestQuestionInfo(questionInfoTestDTO);
+    @GetMapping("/selectTestK14QuestionInfoList")
+    @ApiOperation("取模拟考试题库")
+    public ResponsePageInfo<QuestionInfo> selectTestK14QuestionInfoList(@ModelAttribute QuestionInfoTestDTO questionInfoTestDTO){
+        List<QuestionInfo> list = questionInfoService.selectTestK14QuestionInfoList(questionInfoTestDTO);
+        return toResponsePageInfo(list);
+    }
+
+    /**
+     * 查询免费题库
+     */
+    @GetMapping("/selectFreeQuestionInfo")
+    @ApiOperation("查询免费题库")
+    public ResponsePageInfo<QuestionInfo> selectFreeQuestionInfo(QuestionInfoFreeDTO freeDTO){
+        List<QuestionInfo> list = questionInfoService.selectFreeQuestionInfo(freeDTO);
         return toResponsePageInfo(list);
     }
 }

+ 13 - 0
jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionCollectionController.java

@@ -11,6 +11,7 @@ import com.miaxis.common.exception.CustomException;
 import com.miaxis.common.utils.SecurityUtils;
 import com.miaxis.question.domain.QuestionCollection;
 import com.miaxis.question.dto.QuestionCollectionDTO;
+import com.miaxis.question.dto.QuestionCollectionDelDTO;
 import com.miaxis.question.dto.QuestionCollectionListDTO;
 import com.miaxis.question.service.IQuestionCollectionService;
 import io.swagger.annotations.*;
@@ -171,6 +172,18 @@ public class QuestionCollectionController extends BaseController {
 
     }
 
+    @Log(title = "collectionQuestion", businessType = BusinessTypeEnum.DELETE)
+    @DeleteMapping("/cancelAll")
+    @ApiOperation("清空收藏")
+    public  Response<Integer> removeAll(@RequestBody QuestionCollectionDelDTO questionCollectionDelDTO){
+        Long userId = SecurityUtils.getLoginUser().getStudent().getId();
+        QueryWrapper<QuestionCollection> queryWrapper = new QueryWrapper<QuestionCollection>();
+        queryWrapper.eq("user_id",userId);
+        queryWrapper.eq("km",questionCollectionDelDTO.getKm());
+        queryWrapper.eq("car_type",questionCollectionDelDTO.getCarType());
+        questionCollectionService.remove(queryWrapper);
+        return Response.success();
+    }
 
 
 

+ 15 - 13
jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionInfoController.java

@@ -5,9 +5,7 @@ import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.core.page.ResponsePageInfo;
 import com.miaxis.question.domain.QuestionInfo;
-import com.miaxis.question.dto.QuestionInfoDTO;
-import com.miaxis.question.dto.QuestionInfoFlDTO;
-import com.miaxis.question.dto.QuestionInfoTestDTO;
+import com.miaxis.question.dto.*;
 import com.miaxis.question.service.IQuestionInfoService;
 import com.miaxis.question.vo.QuestionInfoDfVO;
 import com.miaxis.question.vo.QuestionInfoFlVO;
@@ -172,25 +170,29 @@ public class QuestionInfoController extends BaseController{
     }
 
 
+
+
     /**
-     * 查询模拟考试题库
+     * 查询模拟考试科目1与4题库
      */
-    @GetMapping("/selectTestQuestionInfo")
-    @ApiOperation("查询模拟考试题库")
-    public ResponsePageInfo<QuestionInfo> selectTestQuestionInfo(@ModelAttribute QuestionInfoTestDTO questionInfoTestDTO){
-        List<QuestionInfo> list = questionInfoService.selectTestQuestionInfo(questionInfoTestDTO);
+    @GetMapping("/selectTestK14QuestionInfoList")
+    @ApiOperation("模拟考试题库")
+    public ResponsePageInfo<QuestionInfo> selectTestK14QuestionInfoList(@ModelAttribute QuestionInfoTestDTO questionInfoTestDTO){
+        List<QuestionInfo> list = questionInfoService.selectTestK14QuestionInfoList(questionInfoTestDTO);
         return toResponsePageInfo(list);
     }
 
 
     /**
-     * 查询免费题库
+     * 查询秘密卷
      */
-    @GetMapping("/selectFreeQuestionInfo")
-    @ApiOperation("查询免费题库")
-    public ResponsePageInfo<QuestionInfo> selectFreeQuestionInfo(){
-        List<QuestionInfo> list = questionInfoService.selectFreeQuestionInfo();
+    @GetMapping("/selectMiQuestionInfoList")
+    @ApiOperation("查询秘密卷")
+    public ResponsePageInfo<QuestionInfo> selectMiQuestionInfoList(@ModelAttribute QuestionInfoMiDTO questionInfoMiDTO){
+        List<QuestionInfo> list = questionInfoService.selectMiQuestionInfoList(questionInfoMiDTO);
         return toResponsePageInfo(list);
     }
+
+
 }
 

+ 15 - 0
jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionWrongController.java

@@ -11,6 +11,7 @@ import com.miaxis.common.exception.CustomException;
 import com.miaxis.common.utils.SecurityUtils;
 import com.miaxis.question.domain.QuestionWrong;
 import com.miaxis.question.dto.QuestionWrongDTO;
+import com.miaxis.question.dto.QuestionWrongDelDTO;
 import com.miaxis.question.dto.QuestionWrongListDTO;
 import com.miaxis.question.service.IQuestionWrongService;
 import io.swagger.annotations.*;
@@ -150,4 +151,18 @@ public class QuestionWrongController extends BaseController {
         return Response.success();
 
     }
+
+    @Log(title = "wrongQuestion", businessType = BusinessTypeEnum.DELETE)
+    @DeleteMapping("/cancelAll")
+    @ApiOperation("清空错题")
+    public  Response<Integer> removeAll(@RequestBody QuestionWrongDelDTO questionWrongDelDTO){
+        Long userId = SecurityUtils.getLoginUser().getStudent().getId();
+        QueryWrapper<QuestionWrong> queryWrapper= new QueryWrapper<QuestionWrong>();
+        queryWrapper.eq("user_id",userId);
+        queryWrapper.eq("km",questionWrongDelDTO.getKm());
+        queryWrapper.eq("car_type",questionWrongDelDTO.getCarType());
+        questionWrongService.remove(queryWrapper);
+        return Response.success();
+    }
+
 }

+ 26 - 10
jpcj-service/src/main/java/com/miaxis/question/domain/QuestionInfo.java

@@ -26,12 +26,6 @@ public class QuestionInfo extends BaseBusinessEntity{
     @ApiModelProperty(value = " 主键")
     private Long id;
 
-    /** 快通ID */
-    @Excel(name = "快通ID")
-    @TableField("id_kt")
-    @ApiModelProperty(value = "快通ID")
-    private Long idKt;
-
     /** 一点通ID */
     @Excel(name = "一点通ID")
     @TableField("id_ydt")
@@ -216,10 +210,10 @@ public class QuestionInfo extends BaseBusinessEntity{
     private Integer questionType;
 
 
-    /** 题目类型 */
-    @Excel(name = "题目类型")
-    @TableField("question_type")
-    @ApiModelProperty(value = "题目类型 1判断,2选择,3多选")
+    /** 科目 */
+    @Excel(name = "科目")
+    @TableField("subject")
+    @ApiModelProperty(value = "科目")
     private Integer subject;
 
     /** 分类练习排序字段 */
@@ -249,4 +243,26 @@ public class QuestionInfo extends BaseBusinessEntity{
     private Integer placeSort;
 
 
+    /** 章节ID */
+    @Excel(name = "章节ID")
+    @TableField("chapter_id")
+    @ApiModelProperty(value = "章节ID")
+    private Integer chapterId;
+
+    /** 难度等级1-5 */
+    @Excel(name = "难度等级1-5")
+    @TableField("diff_degree")
+    @ApiModelProperty(value = "难度等级1-5")
+    private Integer diffDegree;
+
+
+    /** 是否新规 */
+    @Excel(name = "是否新规")
+    @TableField("is_new")
+    @ApiModelProperty(value = "是否新规 0否 1是")
+    private Integer isNew;
+
+
+
+
 }

+ 89 - 0
jpcj-service/src/main/java/com/miaxis/question/domain/TAppExamRule.java

@@ -0,0 +1,89 @@
+package com.miaxis.question.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 考试取题对象 t_app_exam_rule
+ *
+ * @author miaxis
+ * @date 2022-05-23
+ */
+@Data
+@TableName("t_app_exam_rule")
+@ApiModel(value = "TAppExamRule", description = "考试取题对象 t_app_exam_rule")
+public class TAppExamRule extends BaseBusinessEntity {
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    @TableField("id")
+    @ApiModelProperty(value = "$column.columnComment")
+    private Long id;
+
+    /** 车型 */
+    @Excel(name = "车型")
+    @TableField("gs")
+    @ApiModelProperty(value = "车型")
+    private String gs;
+
+    /** 科目 */
+    @Excel(name = "科目")
+    @TableField("kemu")
+    @ApiModelProperty(value = "科目")
+    private Integer kemu;
+
+    /** 章节ID */
+    @Excel(name = "章节ID")
+    @TableField("chapter_id")
+    @ApiModelProperty(value = "章节ID")
+    private Integer chapterId;
+
+    /** 总题库 */
+    @Excel(name = "总题库")
+    @TableField("total_count")
+    @ApiModelProperty(value = "总题库")
+    private Integer totalCount;
+
+    /** 判断题数 */
+    @Excel(name = "判断题数")
+    @TableField("judge_count")
+    @ApiModelProperty(value = "判断题数")
+    private Integer judgeCount;
+
+    /** 选择题数 */
+    @Excel(name = "选择题数")
+    @TableField("choice_count")
+    @ApiModelProperty(value = "选择题数")
+    private Integer choiceCount;
+
+    /** 多择题数 */
+    @Excel(name = "多择题数")
+    @TableField("multiple_choice_count")
+    @ApiModelProperty(value = "多择题数")
+    private Integer multipleChoiceCount;
+
+    /** 困难题数 */
+    @Excel(name = "困难题数")
+    @TableField("difficult_count")
+    @ApiModelProperty(value = "困难题数")
+    private Integer difficultCount;
+
+    /** 地区编号 */
+    @Excel(name = "地区编号")
+    @TableField("areacode")
+    @ApiModelProperty(value = "地区编号")
+    private Integer areacode;
+
+    /** 城市ID */
+    @Excel(name = "城市ID")
+    @TableField("city_id")
+    @ApiModelProperty(value = "城市ID")
+    private Integer cityId;
+
+
+}

+ 27 - 0
jpcj-service/src/main/java/com/miaxis/question/dto/QuestionCollectionDelDTO.java

@@ -0,0 +1,27 @@
+package com.miaxis.question.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * wrong对象 question_wrong
+ *
+ * @author miaxis
+ * @date 2021-08-19
+ */
+@Data
+public class QuestionCollectionDelDTO {
+
+
+
+    /** 科目 */
+    @ApiModelProperty(value = "考试科目(科目一、科目二、科目三、科目四)")
+    private String km;
+
+    /** 车型 */
+    @ApiModelProperty(value = "车型(小车 、客车、货车、摩托车)")
+    private String carType;
+
+
+
+}

+ 17 - 8
jpcj-service/src/main/java/com/miaxis/question/dto/QuestionInfoDTO.java

@@ -119,14 +119,6 @@ public class QuestionInfoDTO extends BaseBusinessEntity{
     @ApiModelProperty(value = "精选题 0否 1是")
     private String excellIssue;
 
-    /** 是否是仿真考试题目 */
-    @ApiModelProperty(value = "是否是仿真考试题目")
-    private String copyIssue;
-
-    /** 是否是真实考场模拟题目 */
-    @ApiModelProperty(value = "是否是真实考场模拟题目")
-    private String mockIssue;
-
     /** 题目在顺序练习中所属的模块名称 */
     @ApiModelProperty(value = "题目在顺序练习中所属的模块名称")
     private String sequeIssueName;
@@ -186,5 +178,22 @@ public class QuestionInfoDTO extends BaseBusinessEntity{
     private String sortName;
 
 
+    /** 章节ID  */
+    @ApiModelProperty(value = "1:分类练习;2:精选考题;3:顺序练习;4:地方专题;")
+    private Integer chapterId;
+
+    /**
+     * 难度等级1-5
+     */
+    @ApiModelProperty(value = "分类字段名",hidden = true)
+    private String diffDegree;
+
+
+    /**
+     * 是否是新规题
+     */
+    @ApiModelProperty(value = "是否是新规题 0否 1是",hidden = true)
+    private Integer isNew;
+
 
 }

+ 0 - 6
jpcj-service/src/main/java/com/miaxis/question/dto/QuestionInfoFreeDTO.java

@@ -16,12 +16,6 @@ public class QuestionInfoFreeDTO extends BaseBusinessEntity{
     private static final long serialVersionUID = 1L;
 
 
-    @ApiModelProperty(hidden = true)
-    private Integer questionType;
-
-    @ApiModelProperty(hidden = true)
-    private Integer num;
-
     @ApiModelProperty(value = "科目")
     private Integer subject;
 }

+ 29 - 0
jpcj-service/src/main/java/com/miaxis/question/dto/QuestionInfoMiDTO.java

@@ -0,0 +1,29 @@
+package com.miaxis.question.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 地方题选分类返回对象
+ * @author miaxis
+ * @date 2021-10-20
+ */
+@Data
+@ApiModel(value = "QuestionInfoMiDTO", description = "秘卷输入对象")
+public class QuestionInfoMiDTO {
+    private static final long serialVersionUID = 1L;
+
+
+    @ApiModelProperty(value = "科目 科目一:1; 科目一:4")
+    private Integer kemu;
+
+    @ApiModelProperty(value = "取题车型 小车:xc;客车:kc;货车:hc;摩托车:mtc")
+    private String gs;
+
+    @ApiModelProperty(value = "类型 3:秘卷1  4:秘卷2  ")
+    private Integer category;
+
+}

+ 17 - 7
jpcj-service/src/main/java/com/miaxis/question/dto/QuestionInfoTestDTO.java

@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * 地方题选分类返回对象
  * @author miaxis
@@ -13,32 +15,40 @@ import lombok.Data;
  */
 @Data
 @ApiModel(value = "QuestionInfoTestDTO", description = "模拟考试输入对象")
-public class QuestionInfoTestDTO extends BaseBusinessEntity{
+public class QuestionInfoTestDTO {
     private static final long serialVersionUID = 1L;
 
 
-    @ApiModelProperty(value = "科目")
+    @ApiModelProperty(value = "科目 科目一:1; 科目一:4")
     private Integer subject;
 
-    @ApiModelProperty(value = "是否小车 1:是 否:空")
+    @ApiModelProperty(hidden = true)
     private String liceCar;
 
-    @ApiModelProperty(value = "是否客车 1:是 否:空")
+    @ApiModelProperty(hidden = true)
     private String liceBus;
 
-    @ApiModelProperty(value = "是否货车 1:是 否:空")
+    @ApiModelProperty(hidden = true)
     private String liceTruck;
 
-    @ApiModelProperty(value = "是否摩托车 1:是 否:空")
+    @ApiModelProperty(hidden = true)
     private String liceMoto;
 
+    @ApiModelProperty(value = "取题车型 小车:xc;客车:kc;货车:hc;摩托车:mtc")
+    private String gs;
+
     @ApiModelProperty(hidden = true)
     private String excellIssueName;
 
-
     @ApiModelProperty(hidden = true)
     private Integer questionType;
 
+    @ApiModelProperty(hidden = true)
+    private Integer chapterId;
+
+    @ApiModelProperty(hidden = true)
+    private List<Integer> diffDegree;
+
     @ApiModelProperty(hidden = true)
     private Integer num;
 

+ 27 - 0
jpcj-service/src/main/java/com/miaxis/question/dto/QuestionWrongDelDTO.java

@@ -0,0 +1,27 @@
+package com.miaxis.question.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * wrong对象 question_wrong
+ *
+ * @author miaxis
+ * @date 2021-08-19
+ */
+@Data
+public class QuestionWrongDelDTO {
+
+
+
+    /** 科目 */
+    @ApiModelProperty(value = "考试科目(科目一、科目二、科目三、科目四)")
+    private String km;
+
+    /** 车型 */
+    @ApiModelProperty(value = "车型(小车 、客车、货车、摩托车)")
+    private String carType;
+
+
+
+}

+ 4 - 0
jpcj-service/src/main/java/com/miaxis/question/mapper/QuestionInfoMapper.java

@@ -56,7 +56,11 @@ public interface QuestionInfoMapper extends BaseMapper<QuestionInfo> {
 
     List<QuestionInfo> selectTestQuestionInfoList(QuestionInfoTestDTO questionInfoTestDTO);
 
+    int selectQuestionInfoCount(QuestionInfoTestDTO questionInfoTestDTO);
+
     List<QuestionInfo> selectFreeQuestionInfoList(QuestionInfoFreeDTO freeDTO);
 
     List<QuestionInfo> selectQuestionInfoListByYdtIds(Long[] ids);
+
+    List<QuestionInfo> selectMiQuestionInfoList(QuestionInfoMiDTO questionInfoMiDTO);
 }

+ 23 - 0
jpcj-service/src/main/java/com/miaxis/question/mapper/TAppExamRuleMapper.java

@@ -0,0 +1,23 @@
+package com.miaxis.question.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.question.domain.TAppExamRule;
+
+import java.util.List;
+
+/**
+ * 考试取题Mapper接口
+ *
+ * @author miaxis
+ * @date 2022-05-23
+ */
+public interface TAppExamRuleMapper extends BaseMapper<TAppExamRule> {
+    /**
+     * 查询考试取题列表
+     *
+     * @param tAppExamRule 考试取题
+     * @return 考试取题集合
+     */
+    public List<TAppExamRule> selectTAppExamRuleList(TAppExamRule tAppExamRule);
+
+}

+ 4 - 3
jpcj-service/src/main/java/com/miaxis/question/service/IQuestionInfoService.java

@@ -40,11 +40,12 @@ public interface IQuestionInfoService extends IService<QuestionInfo>{
 
     List<QuestionInfoExcelTypeVo> getIssueTypes(int issueTypeValue, Integer typeValue);
 
-    List<QuestionInfo> selectTestQuestionInfo(QuestionInfoTestDTO questionInfoTestDTO);
-
-    List<QuestionInfo> selectFreeQuestionInfo();
+    List<QuestionInfo> selectFreeQuestionInfo(QuestionInfoFreeDTO freeDTO);
 
     List<QuestionInfo> selectQuestionInfoListByYdtIds(Long[] ids);
 
+    List<QuestionInfo> selectTestK14QuestionInfoList(QuestionInfoTestDTO questionInfoTestDTO);
+
+    List<QuestionInfo> selectMiQuestionInfoList(QuestionInfoMiDTO questionInfoMiDTO);
 }
 

+ 22 - 0
jpcj-service/src/main/java/com/miaxis/question/service/ITAppExamRuleService.java

@@ -0,0 +1,22 @@
+package com.miaxis.question.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.miaxis.question.domain.TAppExamRule;
+
+import java.util.List;
+
+/**
+ * 考试取题Service接口
+ *
+ * @author miaxis
+ * @date 2022-05-23
+ */
+public interface ITAppExamRuleService extends IService<TAppExamRule>{
+    /**
+     * 查询考试取题列表
+     *
+     * @param tAppExamRule 考试取题
+     * @return 考试取题集合
+     */
+    public List<TAppExamRule> selectTAppExamRuleList(TAppExamRule tAppExamRule);
+}

+ 197 - 100
jpcj-service/src/main/java/com/miaxis/question/service/impl/QuestionInfoServiceImpl.java

@@ -4,15 +4,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.miaxis.common.exception.CustomException;
 import com.miaxis.common.exception.user.UserException;
 import com.miaxis.question.domain.QuestionInfo;
+import com.miaxis.question.domain.TAppExamRule;
 import com.miaxis.question.dto.*;
 import com.miaxis.question.mapper.QuestionInfoMapper;
 import com.miaxis.question.service.IQuestionInfoService;
+import com.miaxis.question.service.ITAppExamRuleService;
 import com.miaxis.question.vo.*;
 import org.apache.ibatis.executor.ExecutorException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Random;
 
 /**
  * 题库Service业务层处理
@@ -25,6 +29,9 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
     @Autowired
     private QuestionInfoMapper questionInfoMapper;
 
+    @Autowired
+    private ITAppExamRuleService appExamRuleService;
+
     /**
      * 查询题库列表
      *
@@ -32,12 +39,12 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
      * @return 题库
      */
     @Override
-    public List<QuestionInfo> selectQuestionInfoList(QuestionInfoDTO questionInfoDTO){
+    public List<QuestionInfo> selectQuestionInfoList(QuestionInfoDTO questionInfoDTO) {
 
         //1:分类练习:class_sort;2:精选考题:excell_sort;3:地方专题:place_sort;4:顺序练习:seque_sort;
         Integer sort = questionInfoDTO.getSort();
-        if(sort!=null) {
-            switch (sort){
+        if (sort != null) {
+            switch (sort) {
                 case 1:
                     questionInfoDTO.setSortName("class_sort");
                     break;
@@ -104,126 +111,216 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
 
     @Override
     public List<QuestionInfoExcelTypeVo> getIssueTypes(int issueTypeValue, Integer subject) {
-        if (issueTypeValue == 1){
+        if (issueTypeValue == 1) {
             return questionInfoMapper.selectIssueType1(subject);
         }
-        if (issueTypeValue == 2){
+        if (issueTypeValue == 2) {
             return questionInfoMapper.selectIssueType2(subject);
         }
-        if (issueTypeValue == 3){
+        if (issueTypeValue == 3) {
             return questionInfoMapper.selectIssueType3(subject);
         }
-        if (issueTypeValue == 4){
+        if (issueTypeValue == 4) {
             return questionInfoMapper.selectIssueType4(subject);
         }
         return null;
 
 
+    }
+
+
+    @Override
+    public List<QuestionInfo> selectFreeQuestionInfo(QuestionInfoFreeDTO freeDTO) {
+        List<QuestionInfo> list = questionInfoMapper.selectFreeQuestionInfoList(freeDTO);
+        return list;
+    }
+
 
+    public List<QuestionInfo> selectTestQuestionInfoList(QuestionInfoTestDTO questionInfoTestDTO) {
+        return questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
     }
 
     @Override
-    public List<QuestionInfo> selectTestQuestionInfo(QuestionInfoTestDTO questionInfoTestDTO) {
-
-
-        if("1".equals(questionInfoTestDTO.getLiceMoto())) {
-            if(questionInfoTestDTO.getSubject()==1){
-                questionInfoTestDTO.setQuestionType(1);
-                questionInfoTestDTO.setNum(20);
-                List<QuestionInfo> list1 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                questionInfoTestDTO.setQuestionType(2);
-                questionInfoTestDTO.setNum(30);
-                List<QuestionInfo> list2 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                list1.addAll(list2);
-                return list1;
-            } else if (questionInfoTestDTO.getSubject()==4) {
-                questionInfoTestDTO.setQuestionType(1);
-                questionInfoTestDTO.setNum(20);
-                List<QuestionInfo> list1 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                questionInfoTestDTO.setQuestionType(2);
-                questionInfoTestDTO.setNum(20);
-                List<QuestionInfo> list2 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                questionInfoTestDTO.setQuestionType(3);
-                questionInfoTestDTO.setNum(10);
-                List<QuestionInfo> list3 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                list1.addAll(list2);
-                list1.addAll(list3);
-                return list1;
+    public List<QuestionInfo> selectTestK14QuestionInfoList(QuestionInfoTestDTO qt) {
+
+        int total = 100;
+        if ("mtc".equals(qt.getGs())) { //如果是摩托车取题50
+            total = 50;
+        } else if (qt.getSubject() == 1) {
+            total = 100;
+        } else if (qt.getSubject() == 4) {
+            total = 50;
+        }
+
+        if ("mtc".equals(qt.getGs())) {
+            qt.setLiceMoto("1");
+        } else if ("xc".equals(qt.getGs())) {
+            qt.setLiceCar("1");
+        } else if ("hc".equals(qt.getGs())) {
+            qt.setLiceTruck("1");
+        } else if ("kc".equals(qt.getGs())) {
+            qt.setLiceBus("1");
+        }
+
+        //全题库
+        List<QuestionInfo> allList = new ArrayList<QuestionInfo>();
+
+        //判断题
+        List<QuestionInfo> judgeList = new ArrayList<QuestionInfo>();
+        //选择题
+        List<QuestionInfo> choiceList = new ArrayList<QuestionInfo>();
+        //多选题
+        List<QuestionInfo> multipleList = new ArrayList<QuestionInfo>();
+
+        //简单题
+        List<Integer> easyDegree = new ArrayList<Integer>();
+        easyDegree.add(1);
+        easyDegree.add(2);
+        easyDegree.add(3);
+        //难题
+        List<Integer> diffDegree = new ArrayList<Integer>();
+        diffDegree.add(4);
+        diffDegree.add(5);
+        //科目一通用
+        TAppExamRule tAppExamRule = new TAppExamRule();
+        tAppExamRule.setKemu(qt.getSubject());
+        tAppExamRule.setGs(qt.getGs());
+        tAppExamRule.setAreacode(0);
+
+        List<TAppExamRule> list = appExamRuleService.selectTAppExamRuleList(tAppExamRule);
+        if (list.size() == 0) {
+            return allList;
+        }
+        for (int i = 0; i < list.size(); i++) {
+            TAppExamRule er = list.get(i);
+            int easyJudge = er.getJudgeCount();
+            int easyChoice = er.getChoiceCount();
+            int easyMultiple = er.getMultipleChoiceCount();
+            int chapterId = er.getChapterId();
+
+            QuestionInfoTestDTO questionInfoTestDTO = new QuestionInfoTestDTO();
+            questionInfoTestDTO.setChapterId(chapterId);
+            questionInfoTestDTO.setDiffDegree(diffDegree);
+            questionInfoTestDTO.setQuestionType(1);
+            int judgeTotal = questionInfoMapper.selectQuestionInfoCount(questionInfoTestDTO); //章节判断难题总数
+            questionInfoTestDTO.setQuestionType(2);
+            int choiceTotal = questionInfoMapper.selectQuestionInfoCount(questionInfoTestDTO); //章节选择难题总数
+            questionInfoTestDTO.setQuestionType(3);
+            int multipleTotal = questionInfoMapper.selectQuestionInfoCount(questionInfoTestDTO); //章节多选难题总数
+
+
+            int x = i + 1;
+            System.out.println("第" + x + "轮easyJudge:" + easyJudge);
+
+            Random random = new Random();
+            int p = 0; //判断题
+            int d = 0; //单选题
+            int m = 0; //多选题
+            for (int j = 0; j < er.getDifficultCount(); j++) {
+                if (random.nextInt(9) <= 2) {   //判断题
+                    if (easyJudge - 1 < 0 || judgeTotal - p <= 0) {
+                        j--;
+                    } else {
+                        p++;
+                        easyJudge--;
+                    }
+                } else if (random.nextInt(9) <= 5) {  //单选题
+                    if (easyChoice - 1 < 0 || choiceTotal - d <= 0) {
+                        j--;
+                    } else {
+                        d++;
+                        easyChoice--;
+                    }
+                } else if (random.nextInt(9) <= 8) {    //多选题
+                    if (easyMultiple - 1 < 0 || multipleTotal - m <= 0) {
+                        j--;
+                    } else {
+                        m++;
+                        easyMultiple--;
+                    }
+                }
             }
-        } else {
-            if(questionInfoTestDTO.getSubject()==1){
-                //旧判断20题
-                questionInfoTestDTO.setQuestionType(1);
-                questionInfoTestDTO.setNum(20);
-                questionInfoTestDTO.setExcellIssueName("必");
-                List<QuestionInfo> list1 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                //新判断20题
-                questionInfoTestDTO.setQuestionType(1);
-                questionInfoTestDTO.setNum(20);
-                questionInfoTestDTO.setExcellIssueName("新");
-                List<QuestionInfo> list2 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                //旧选择50题
-                questionInfoTestDTO.setQuestionType(2);
-                questionInfoTestDTO.setNum(50);
-                questionInfoTestDTO.setExcellIssueName("必");
-                List<QuestionInfo> list3 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                //新选择10题
-                questionInfoTestDTO.setQuestionType(2);
-                questionInfoTestDTO.setNum(10);
-                questionInfoTestDTO.setExcellIssueName("新");
-                List<QuestionInfo> list4 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-
-                list1.addAll(list2);
-                list1.addAll(list3);
-                list1.addAll(list4);
-                return list1;
-            } else if (questionInfoTestDTO.getSubject()==4) {
-                questionInfoTestDTO.setQuestionType(1);
-                questionInfoTestDTO.setNum(20);
-                questionInfoTestDTO.setExcellIssueName("必");
-                List<QuestionInfo> list1 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-
-                questionInfoTestDTO.setQuestionType(1);
-                questionInfoTestDTO.setNum(10);
-                questionInfoTestDTO.setExcellIssueName("新");
-                List<QuestionInfo> list2 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-
-                questionInfoTestDTO.setQuestionType(2);
-                questionInfoTestDTO.setNum(10);
-                questionInfoTestDTO.setExcellIssueName("必");
-                List<QuestionInfo> list3 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-
-                questionInfoTestDTO.setQuestionType(3);
-                questionInfoTestDTO.setNum(10);
-                questionInfoTestDTO.setExcellIssueName("必");
-                List<QuestionInfo> list4 = questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
-                list1.addAll(list2);
-                list1.addAll(list3);
-                list1.addAll(list4);
-                return list1;
+
+//                System.out.println("简单判断:" + easyJudge);
+//                System.out.println("简单选择:" + easyChoice);
+//                System.out.println("简单多选:" + easyMultiple);
+//                System.out.println("难题判断:" + p);
+//                System.out.println("难题选择:" + d);
+//                System.out.println("难题多择:" + m);
+//                System.out.println("---------------------------------------------");
+
+            //判断简单
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(easyDegree);       //简单难度
+            qt.setQuestionType(1);              //判断题
+            qt.setNum(easyJudge);               //题数
+            List<QuestionInfo> easyJudgeList = this.selectTestQuestionInfoList(qt);
+            //单选简单
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(easyDegree);       //简单难度
+            qt.setQuestionType(2);              //判断题
+            qt.setNum(easyChoice);              //题数
+            List<QuestionInfo> easyChoiceList = this.selectTestQuestionInfoList(qt);
+            //多选简单
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(easyDegree);       //简单难度
+            qt.setQuestionType(3);              //判断题
+            qt.setNum(easyMultiple);              //题数
+            List<QuestionInfo> easyMultipleList = this.selectTestQuestionInfoList(qt);
+
+            //判断难题
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(diffDegree);       //高难度
+            qt.setQuestionType(1);              //判断题
+            qt.setNum(p);                       //题数
+            List<QuestionInfo> diffJudgeList = this.selectTestQuestionInfoList(qt);
+            if (p != diffJudgeList.size()) {
+                System.out.println("p!=diffJudgeList.size()");
+                break;
             }
+
+            //单选难题
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(diffDegree);       //高难度
+            qt.setQuestionType(2);              //判断题
+            qt.setNum(d);                       //题数
+            List<QuestionInfo> diffChoiceList = this.selectTestQuestionInfoList(qt);
+            if (d != diffChoiceList.size()) {
+                System.out.println("d!=diffChoiceList.size()");
+                break;
+            }
+            //多选简单
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(diffDegree);       //高难度
+            qt.setQuestionType(3);              //判断题
+            qt.setNum(m);                       //题数
+            List<QuestionInfo> diffMultipleList = this.selectTestQuestionInfoList(qt);
+            if (m != diffMultipleList.size()) {
+                System.out.println("m!=diffMultipleList.size()");
+                break;
+            }
+
+            judgeList.addAll(easyJudgeList);
+            judgeList.addAll(diffJudgeList);
+            choiceList.addAll(easyChoiceList);
+            choiceList.addAll(diffChoiceList);
+            multipleList.addAll(easyMultipleList);
+            multipleList.addAll(diffMultipleList);
         }
-        return null;
+        allList.addAll(judgeList);
+        allList.addAll(choiceList);
+        allList.addAll(multipleList);
+//            System.out.println("error:" + error);
+//            System.out.println("allList:" + allList.size());
+        return allList;
     }
 
-
     @Override
-    public List<QuestionInfo> selectFreeQuestionInfo() {
-        QuestionInfoFreeDTO freeDTO =  new QuestionInfoFreeDTO();
-        freeDTO.setNum(10);
-        freeDTO.setQuestionType(1);
-        freeDTO.setSubject(1);
-        List<QuestionInfo> list1 = questionInfoMapper.selectFreeQuestionInfoList(freeDTO);
-        freeDTO.setQuestionType(2);
-        List<QuestionInfo> list2 = questionInfoMapper.selectFreeQuestionInfoList(freeDTO);
-        freeDTO.setSubject(4);
-        freeDTO.setQuestionType(3);
-        List<QuestionInfo> list3 = questionInfoMapper.selectFreeQuestionInfoList(freeDTO);
-        list1.addAll(list2);
-        list1.addAll(list3);
-        return list1;
+    public List<QuestionInfo> selectMiQuestionInfoList(QuestionInfoMiDTO questionInfoMiDTO) {
+        return questionInfoMapper.selectMiQuestionInfoList(questionInfoMiDTO);
     }
 
 
 
+
 }

+ 34 - 0
jpcj-service/src/main/java/com/miaxis/question/service/impl/TAppExamRuleServiceImpl.java

@@ -0,0 +1,34 @@
+package com.miaxis.question.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.miaxis.question.domain.TAppExamRule;
+import com.miaxis.question.mapper.TAppExamRuleMapper;
+import com.miaxis.question.service.ITAppExamRuleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 考试取题Service业务层处理
+ *
+ * @author miaxis
+ * @date 2022-05-23
+ */
+@Service
+public class TAppExamRuleServiceImpl extends ServiceImpl<TAppExamRuleMapper, TAppExamRule> implements ITAppExamRuleService {
+
+    @Autowired
+    private TAppExamRuleMapper tAppExamRuleMapper;
+
+    /**
+     * 查询考试取题列表
+     *
+     * @param tAppExamRule 考试取题
+     * @return 考试取题
+     */
+    @Override
+    public List<TAppExamRule> selectTAppExamRuleList(TAppExamRule tAppExamRule){
+        return tAppExamRuleMapper.selectTAppExamRuleList(tAppExamRule);
+    }
+}

+ 82 - 9
jpcj-service/src/main/resources/mapper/question/QuestionInfoMapper.xml

@@ -41,6 +41,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="excellSort"    column="excell_sort"    />
         <result property="sequeSort"    column="seque_sort"    />
         <result property="placeSort"    column="place_sort"    />
+        <result property="sequeSort"    column="seque_sort"    />
+        <result property="placeSort"    column="place_sort"    />
+        <result property="chapterId"    column="chapter_id"    />
+        <result property="diffDegree"    column="diff_degree"    />
+        <result property="isNew"    column="is_new"    />
 
 
     </resultMap>
@@ -81,6 +86,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="excellIssueName != null  and excellIssueName != ''"> and excell_issue_name like concat('%', #{excellIssueName}, '%')</if>
             <if test="questionType != null "> and question_type = #{questionType}</if>
             <if test="subject != null  and subject != ''"> and subject = #{subject}</if>
+            <if test="chapterId != null  and chapterId != ''"> and chapter_id = #{chapterId}</if>
+            <if test="diffDegree != null  and diffDegree != ''"> and diff_degree = #{diffDegree}</if>
+            <if test="isNew != null  and isNew != ''"> and is_new = #{isNew}</if>
         </where>
 
         <if test="isRand!=null and isRand!=''"> order by rand() </if>
@@ -120,6 +128,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="excellIssueName != null  and excellIssueName != ''"> and excell_issue_name like concat('%', #{excellIssueName}, '%')</if>
             <if test="classIssueName != null  and classIssueName != ''"> and class_issue_name like concat('%', #{classIssueName}, '%')</if>
             <if test="questionType != null "> and question_type = #{questionType}</if>
+            <if test="chapterId != null  and chapterId != ''"> and chapter_id = #{chapterId}</if>
+            <if test="diffDegree != null  and diffDegree != ''"> and diff_degree = #{diffDegree}</if>
+            <if test="isNew != null  and isNew != ''"> and is_new = #{isNew}</if>
+
         </where>
         limit 0,50
     </select>
@@ -309,7 +321,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selecQuestionInfoExcel4"  resultType="com.miaxis.question.vo.QuestionInfoExcelVo">
         SELECT id,
-             id_kt,
              id_ydt,
              number,
              issue,
@@ -322,9 +333,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
 
+    <select id="selectIssueType5"  resultType="com.miaxis.question.vo.QuestionInfoExcelTypeVo">
+        SELECT
+            DISTINCT case WHEN seque_issue_name is null then '地方专题' else seque_issue_name end as title,
+                     seque_issue as type_id
+        FROM
+            question_info
+        WHERE
+            subject = #{subject}
+          AND lice_car = 1 and
+            seque_issue_name is not null
+        ORDER BY
+            seque_issue + 0 ASC
+    </select>
+
+
+    <select id="selecQuestionInfoExcel5"  resultType="com.miaxis.question.vo.QuestionInfoExcelVo">
+        SELECT id,
+               id_ydt,
+            number,
+            issue,
+            image,
+            excell_issue_name,
+            class_issue_name,
+            place_issue_name,
+            seque_issue_name,
+            question_type  FROM question_info WHERE  seque_issue  = #{typeId} and subject_1 =1 and lice_car = 1
+    </select>
+
+
     <select id="selectQuestionInfoSortList"  resultType="com.miaxis.question.vo.QuestionInfoExcelVo">
         SELECT id,
-             id_kt,
              id_ydt,
              number,
              issue,
@@ -347,27 +386,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectTestQuestionInfoList"   resultMap="QuestionInfoResult">
         select * from question_info
         <where>
-            <if test="liceMoto == null or liceMoto == ''"> and excell_issue_name like concat('%',#{excellIssueName},'%')  </if>
             <if test="subject != null"> and subject = #{subject}</if>
             <if test="questionType != null"> and question_type = #{questionType}</if>
             <if test="liceCar != null  and liceCar != ''"> and lice_car = #{liceCar} </if>
             <if test="liceBus != null  and liceBus != ''"> and lice_bus = #{liceBus}</if>
             <if test="liceTruck != null  and liceTruck != ''"> and lice_truck = #{liceTruck}</if>
             <if test="liceMoto != null  and liceMoto != ''"> and lice_moto = #{liceMoto}</if>
+            <if test="chapterId != null "> and chapter_id = #{chapterId}</if>
+            <if test="diffDegree != null "> and diff_degree in
+                <foreach item="degree" index="index" collection="diffDegree"
+                         open="(" separator="," close=")">
+                    #{degree}
+                </foreach>
+            </if>
         </where>
         ORDER BY rand() limit 0,${num}
     </select>
+    <select id="selectQuestionInfoCount"   resultType="int">
+        select count(1) from question_info
+        <where>
+            <if test="subject != null"> and subject = #{subject}</if>
+            <if test="questionType != null"> and question_type = #{questionType}</if>
+            <if test="liceCar != null  and liceCar != ''"> and lice_car = #{liceCar} </if>
+            <if test="liceBus != null  and liceBus != ''"> and lice_bus = #{liceBus}</if>
+            <if test="liceTruck != null  and liceTruck != ''"> and lice_truck = #{liceTruck}</if>
+            <if test="liceMoto != null  and liceMoto != ''"> and lice_moto = #{liceMoto}</if>
+            <if test="chapterId != null "> and chapter_id = #{chapterId}</if>
+            <if test="diffDegree != null "> and diff_degree in
+                <foreach item="degree" index="index" collection="diffDegree"
+                         open="(" separator="," close=")">
+                    #{degree}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+
 
 
     <select id="selectFreeQuestionInfoList"   resultMap="QuestionInfoResult">
-        select * from question_info
+        select q1.* from question_info q1 join question_free q2 on q1.id = q2.id
         <where>
-            and excell_issue_name like '%选学%'
-            and lice_car = 1
-            <if test="subject != null"> and subject = #{subject}</if>
-            <if test="questionType != null"> and question_type = #{questionType}</if>
+            <if test="subject != null"> and q2.subject = #{subject}</if>
         </where>
-        ORDER BY id limit 0,${num}
+         order by q2.free_sort
     </select>
 
 
@@ -383,4 +445,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
 
+    <select id="selectMiQuestionInfoList" parameterType="QuestionInfoMiDTO" resultMap="QuestionInfoResult">
+        select * from
+            (select * from question_info t2 join
+                           (SELECT substring_index(group_concat(t.id order by t.id desc ),',',1) maxid FROM question_info t GROUP BY t.id_ydt) t1 on t2.id = t1.maxid) t3
+                JOIN t_app_question_category tt ON t3.id_ydt = tt.question_id where tt.gs = #{gs} AND tt.kemu = #{kemu} and tt.category = #{category}
+
+    </select>
+
+
+
+
 </mapper>

+ 41 - 0
jpcj-service/src/main/resources/mapper/rule/TAppExamRuleMapper.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.miaxis.question.mapper.TAppExamRuleMapper">
+
+    <resultMap type="TAppExamRule" id="TAppExamRuleResult">
+        <result property="id"    column="id"    />
+        <result property="gs"    column="gs"    />
+        <result property="kemu"    column="kemu"    />
+        <result property="chapterId"    column="chapter_id"    />
+        <result property="totalCount"    column="total_count"    />
+        <result property="judgeCount"    column="judge_count"    />
+        <result property="choiceCount"    column="choice_count"    />
+        <result property="multipleChoiceCount"    column="multiple_choice_count"    />
+        <result property="difficultCount"    column="difficult_count"    />
+        <result property="areacode"    column="areacode"    />
+        <result property="cityId"    column="city_id"    />
+    </resultMap>
+
+    <sql id="selectTAppExamRuleVo">
+        select * from t_app_exam_rule
+    </sql>
+
+    <select id="selectTAppExamRuleList" parameterType="TAppExamRule" resultMap="TAppExamRuleResult">
+        <include refid="selectTAppExamRuleVo"/>
+        <where>
+            <if test="gs != null  and gs != ''"> and gs = #{gs}</if>
+            <if test="kemu != null "> and kemu = #{kemu}</if>
+            <if test="chapterId != null "> and chapter_id = #{chapterId}</if>
+            <if test="totalCount != null "> and total_count = #{totalCount}</if>
+            <if test="judgeCount != null "> and judge_count = #{judgeCount}</if>
+            <if test="choiceCount != null "> and choice_count = #{choiceCount}</if>
+            <if test="multipleChoiceCount != null "> and multiple_choice_count = #{multipleChoiceCount}</if>
+            <if test="difficultCount != null "> and difficult_count = #{difficultCount}</if>
+            <if test="areacode != null "> and areacode = #{areacode}</if>
+            <if test="cityId != null "> and city_id = #{cityId}</if>
+        </where>
+    </select>
+
+</mapper>