Selaa lähdekoodia

视频横竖屏状态添加,模拟考取题操作

小么熊🐻 2 vuotta sitten
vanhempi
commit
8ca7167eac

+ 1 - 9
nbjk-admin/src/main/java/com/miaxis/app/controller/question/QuestionInfoController.java

@@ -184,15 +184,7 @@ public class QuestionInfoController extends BaseController {
     }
 
 
-    /**
-     * 查询免费题库
-     */
-    @GetMapping("/selectFreeQuestionInfo")
-    @ApiOperation("查询免费题库")
-    public ResponsePageInfo<QuestionInfo> selectFreeQuestionInfo(){
-        List<QuestionInfo> list = questionInfoService.selectFreeQuestionInfo();
-        return toResponsePageInfo(list);
-    }
+
 
 
     /**

+ 43 - 0
nbjk-admin/src/main/java/com/miaxis/open/controller/CommonQuestionInfoController.java

@@ -0,0 +1,43 @@
+package com.miaxis.open.controller;
+
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.question.domain.QuestionInfo;
+import com.miaxis.question.dto.QuestionInfoTestDTO;
+import com.miaxis.question.service.IQuestionInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+
+/**
+ * 【题库】Controller
+ *
+ * @author miaxis
+ * @date 2021-10-20
+ */
+@RestController
+@RequestMapping(Constants.OPEN_PREFIX+"/question/info")
+@Api(tags={"【通用-题库】"})
+public class CommonQuestionInfoController extends BaseController {
+    @Autowired
+    private IQuestionInfoService questionInfoService;
+
+    /**
+     * 查询模拟考试科目1与4题库
+     */
+    @GetMapping("/selectTestK14QuestionInfoList")
+    @ApiOperation("取模拟考试题库")
+    public ResponsePageInfo<QuestionInfo> selectTestK14QuestionInfoList(@ModelAttribute QuestionInfoTestDTO questionInfoTestDTO){
+        List<QuestionInfo> list = questionInfoService.selectTestK14QuestionInfoList(questionInfoTestDTO);
+        return toResponsePageInfo(list);
+    }
+
+}
+

+ 90 - 0
nbjk-service/src/main/java/com/miaxis/question/domain/TAppExamRule.java

@@ -0,0 +1,90 @@
+package com.miaxis.question.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+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 */
+    @TableId("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
nbjk-service/src/main/java/com/miaxis/question/dto/QuestionInfoTestDTO.java

@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * 地方题选分类返回对象
  * @author miaxis
@@ -16,28 +18,36 @@ public class QuestionInfoTestDTO extends BaseBusinessEntity {
     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;
 

+ 3 - 0
nbjk-service/src/main/java/com/miaxis/question/mapper/QuestionInfoMapper.java

@@ -55,6 +55,8 @@ 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);
@@ -62,4 +64,5 @@ public interface QuestionInfoMapper extends BaseMapper<QuestionInfo> {
     List<QuestionInfo> selectQuestionWrongList(QuestionWrongListDTO dto);
 
     List<QuestionInfo> selectMiQuestionInfoList(QuestionInfoMiDTO questionInfoMiDTO);
+
 }

+ 23 - 0
nbjk-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
nbjk-service/src/main/java/com/miaxis/question/service/IQuestionInfoService.java

@@ -35,12 +35,12 @@ public interface IQuestionInfoService extends IService<QuestionInfo>{
 
     List<QuestionInfoSxVO> selectSxQuestionInfo(QuestionInfoFlDTO questionInfoFlDTO);
 
-    List<QuestionInfo> selectMiQuestionInfoList(QuestionInfoMiDTO questionInfoMiDTO);
 
     List<QuestionInfo> selectTestQuestionInfo(QuestionInfoTestDTO questionInfoTestDTO);
 
-    List<QuestionInfo> selectFreeQuestionInfo();
 
+    List<QuestionInfo> selectTestK14QuestionInfoList(QuestionInfoTestDTO questionInfoTestDTO);
 
+    List<QuestionInfo> selectMiQuestionInfoList(QuestionInfoMiDTO questionInfoMiDTO);
 }
 

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

+ 229 - 19
nbjk-service/src/main/java/com/miaxis/question/service/impl/QuestionInfoServiceImpl.java

@@ -1,9 +1,14 @@
 package com.miaxis.question.service.impl;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Random;
+
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.miaxis.common.exception.CustomException;
+import com.miaxis.question.domain.TAppExamRule;
 import com.miaxis.question.dto.*;
+import com.miaxis.question.service.ITAppExamRuleService;
 import com.miaxis.question.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -21,7 +26,8 @@ import com.miaxis.question.service.IQuestionInfoService;
 public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, QuestionInfo> implements IQuestionInfoService {
     @Autowired
     private QuestionInfoMapper questionInfoMapper;
-
+    @Autowired
+    private ITAppExamRuleService appExamRuleService;
     /**
      * 查询题库列表
      *
@@ -85,10 +91,7 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
         return questionInfoMapper.selectSxQuestionInfo(questionInfoFlDTO);
     }
 
-    @Override
-    public List<QuestionInfo> selectMiQuestionInfoList(QuestionInfoMiDTO questionInfoMiDTO) {
-        return questionInfoMapper.selectMiQuestionInfoList(questionInfoMiDTO);
-    }
+
 
 
     @Override
@@ -176,21 +179,228 @@ 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>();
+
+        //判断题
+        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();
+
+            int total2 = easyJudge + easyChoice + easyMultiple;
+
+            QuestionInfoTestDTO questionInfoTestDTO = new QuestionInfoTestDTO();
+            questionInfoTestDTO.setChapterId(chapterId);
+            questionInfoTestDTO.setDiffDegree(diffDegree);
+            questionInfoTestDTO.setQuestionType(1);
+
+            if ("mtc".equals(qt.getGs())) {
+                questionInfoTestDTO.setLiceMoto("1");
+            } else if ("xc".equals(qt.getGs())) {
+                questionInfoTestDTO.setLiceCar("1");
+            } else if ("hc".equals(qt.getGs())) {
+                questionInfoTestDTO.setLiceTruck("1");
+            } else if ("kc".equals(qt.getGs())) {
+                questionInfoTestDTO.setLiceBus("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--;
+                    }
+                }
+            }
+
+
+            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("总题数:" + total2);
+
+            System.out.println("---------------------------------------------");
+
+            //判断简单
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(easyDegree);       //简单难度
+            qt.setQuestionType(1);              //判断题
+            qt.setNum(easyJudge);               //题数
+            List<QuestionInfo> easyJudgeList = this.selectTestQuestionInfoList(qt);
+            if (easyJudge != easyJudgeList.size()) {          //简单题不够的情况下,加到难题上
+                System.out.println("easyJudge != easyJudgeList.size()");
+                int easyJudgeQ = easyJudge - easyJudgeList.size();
+                d = d + easyJudgeQ;
+                qt.setNum(easyJudgeList.size());
+            }
+            //单选简单
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(easyDegree);       //简单难度
+            qt.setQuestionType(2);              //判断题
+            qt.setNum(easyChoice);              //题数
+            List<QuestionInfo> easyChoiceList = this.selectTestQuestionInfoList(qt);
+            if (easyChoice != easyChoiceList.size()) {          //简单题不够的情况下,加到难题上
+                System.out.println("easyChoice != easyChoiceList.size()");
+                int easyChoiceQ = easyChoice - easyChoiceList.size();
+                d = d + easyChoiceQ;
+                qt.setNum(easyChoiceList.size());
+            }
+
+            //多选简单
+            qt.setChapterId(er.getChapterId()); //章节ID
+            qt.setDiffDegree(easyDegree);       //简单难度
+            qt.setQuestionType(3);              //判断题
+            qt.setNum(easyMultiple);              //题数
+            List<QuestionInfo> easyMultipleList = this.selectTestQuestionInfoList(qt);
+            if (easyMultiple != easyMultipleList.size()) {          //简单题不够的情况下,加到难题上
+                System.out.println("easyMultiple != easyMultipleList.size()");
+                int easyMultipleQ = easyMultiple - easyMultipleList.size();
+                m = m + easyMultipleQ;
+                qt.setNum(easyMultipleList.size());
+            }
+            //判断难题
+            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);
+            System.out.println("easyMultipleList = " + easyMultipleList.size());
+            System.out.println("diffMultipleList = " + diffMultipleList.size());
+        }
+        allList.addAll(judgeList);
+        allList.addAll(choiceList);
+        allList.addAll(multipleList);
+        System.out.println("judgeList = "+judgeList.size());
+        System.out.println("choiceList = " + choiceList.size());
+        System.out.println("multipleList = " + multipleList.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
nbjk-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);
+    }
+}

+ 25 - 1
nbjk-service/src/main/resources/mapper/question/QuestionInfoMapper.xml

@@ -348,17 +348,41 @@
     <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

+ 41 - 0
nbjk-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>