Эх сурвалжийг харах

Merge branch 'master' of ssh://192.168.8.213:10022/miaxis/twzd

Althars123 3 жил өмнө
parent
commit
bd3cd963c2

+ 17 - 15
twzd-service/src/main/java/com/miaxis/question/service/impl/QuestionInfoServiceImpl.java

@@ -39,21 +39,23 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
 
         //1:分类练习:class_sort;2:精选考题:excell_sort;3:地方专题:place_sort;4:顺序练习:seque_sort;
         Integer sort = questionInfoDTO.getSort();
-        switch (sort){
-            case 1:
-                questionInfoDTO.setSortName("class_sort");
-                break;
-            case 2:
-                questionInfoDTO.setSortName("excell_sort");
-                break;
-            case 3:
-                questionInfoDTO.setSortName("place_sort");
-                break;
-            case 4:
-                questionInfoDTO.setSortName("seque_sort");
-                break;
-            default:
-                throw new CustomException("请正常输入sort字段");
+        if(sort!=null) {
+            switch (sort){
+                case 1:
+                    questionInfoDTO.setSortName("class_sort");
+                    break;
+                case 2:
+                    questionInfoDTO.setSortName("excell_sort");
+                    break;
+                case 3:
+                    questionInfoDTO.setSortName("place_sort");
+                    break;
+                case 4:
+                    questionInfoDTO.setSortName("seque_sort");
+                    break;
+                default:
+                    throw new CustomException("请正常输入sort字段");
+            }
         }
         return questionInfoMapper.selectQuestionInfoList(questionInfoDTO);
     }

+ 1 - 1
twzd-service/src/main/resources/mapper/qustion/QuestionInfoMapper.xml

@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
 
         <if test="isRand!=null and isRand!=''"> order by rand() </if>
-        <if test="isRand==null or isRand=='' and  sort!=null and sort!='' "> order by ${sort}  </if>
+        <if test="isRand==null or isRand=='' and  sort!=null and sort!='' "> order by ${sort} </if>
     </select>