小么熊🐻 2 жил өмнө
parent
commit
3557797549

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

@@ -33,12 +33,12 @@ 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);
     }
 }

+ 11 - 10
jpcj-admin/src/main/java/com/miaxis/app/controller/h5/QuestionInfoController.java

@@ -172,16 +172,6 @@ public class QuestionInfoController extends BaseController{
     }
 
 
-    /**
-     * 查询模拟考试题库
-     */
-    @GetMapping("/selectTestQuestionInfo")
-    @ApiOperation("查询模拟考试题库")
-    public ResponsePageInfo<QuestionInfo> selectTestQuestionInfo(@ModelAttribute QuestionInfoTestDTO questionInfoTestDTO){
-        List<QuestionInfo> list = questionInfoService.selectTestQuestionInfo(questionInfoTestDTO);
-        return toResponsePageInfo(list);
-    }
-
 
     /**
      * 查询免费题库
@@ -192,5 +182,16 @@ public class QuestionInfoController extends BaseController{
         List<QuestionInfo> list = questionInfoService.selectFreeQuestionInfo();
         return toResponsePageInfo(list);
     }
+
+    /**
+     * 查询模拟考试科目1与4题库
+     */
+    @GetMapping("/selectTestK14QuestionInfoList")
+    @ApiOperation("取模拟考试题库")
+    public ResponsePageInfo<QuestionInfo> selectTestK14QuestionInfoList(@ModelAttribute QuestionInfoTestDTO questionInfoTestDTO){
+        List<QuestionInfo> list = questionInfoService.selectTestK14QuestionInfoList(questionInfoTestDTO);
+        return toResponsePageInfo(list);
+    }
+
 }
 

+ 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;
+
+
+}

+ 16 - 6
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 = "科目")
     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;
 

+ 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);
+
+}

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

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

+ 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);
+}

+ 178 - 83
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,8 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
     @Autowired
     private QuestionInfoMapper questionInfoMapper;
 
+    @Autowired
+    private ITAppExamRuleService appExamRuleService;
     /**
      * 查询题库列表
      *
@@ -122,89 +128,6 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
 
     }
 
-    @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;
-            }
-        } 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;
-            }
-        }
-        return null;
-    }
 
 
     @Override
@@ -225,5 +148,177 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
     }
 
 
+    public List<QuestionInfo> selectTestQuestionInfoList(QuestionInfoTestDTO questionInfoTestDTO) {
+        return questionInfoMapper.selectTestQuestionInfoList(questionInfoTestDTO);
+    }
+
+    @Override
+    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>();
+        int error = 0;
+        while (allList.size() != total && error < 10) {
+            System.out.println("error:" + error);
+            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 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) {
+                            j--;
+                        } else {
+                            p++;
+                            easyJudge--;
+                        }
+                    } else if (random.nextInt(9) <= 5) {  //单选题
+                        if (easyChoice - 1 < 0) {
+                            j--;
+                        } else {
+                            d++;
+                            easyChoice--;
+                        }
+                    } else if (random.nextInt(9) <= 8) {    //多选题
+                        if (easyMultiple - 1 < 0) {
+                            j--;
+                        } else {
+                            m++;
+                            easyMultiple--;
+                        }
+                    }
+                }
+
+//                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()");
+                    error++;
+                    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()");
+                    error++;
+                    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()");
+                    error++;
+                    break;
+                }
+
+                judgeList.addAll(easyJudgeList);
+                judgeList.addAll(diffJudgeList);
+                choiceList.addAll(easyChoiceList);
+                choiceList.addAll(diffChoiceList);
+                multipleList.addAll(easyMultipleList);
+                multipleList.addAll(diffMultipleList);
+            }
+            allList.addAll(judgeList);
+            allList.addAll(choiceList);
+            allList.addAll(multipleList);
+//            System.out.println("error:" + error);
+//            System.out.println("allList:" + allList.size());
+        }
+        return allList;
+    }
 
 }

+ 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);
+    }
+}

+ 7 - 1
jpcj-service/src/main/resources/mapper/question/QuestionInfoMapper.xml

@@ -345,13 +345,19 @@ 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>

+ 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>