Browse Source

试题列表,试题详情返回子题

tags/正式版本
王宁 2 years ago
parent
commit
ef16aef5f1

+ 2
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/controller/question/QuestionController.java View File

@@ -74,7 +74,7 @@ public class QuestionController {
74 74
         Integer pageSize = tQuestion.getPageSize();
75 75
         N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
76 76
         PageHelper.startPage(page, pageSize);
77
-        List<SelectQuestionVo> list = tQuestionService.listForSelect(tQuestion);
77
+        List<Map> list = tQuestionService.listForSelect(tQuestion);
78 78
         PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
79 79
         return new ResultVo(0,"获取章节选题列表成功",pageResult);
80 80
     }
@@ -86,7 +86,7 @@ public class QuestionController {
86 86
         N_Utils.validation(new Object[]{page,"显示页码",1,pageSize,"显示条数",1});
87 87
         PageHelper.startPage(page, pageSize);
88 88
         tQuestion.setLsbid(null);
89
-        List<SelectQuestionVo> list = tQuestionService.listForSelect(tQuestion);
89
+        List<Map> list = tQuestionService.listForSelect(tQuestion);
90 90
         PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
91 91
         return new ResultVo(0,"获取知识点选题列表成功",pageResult);
92 92
     }

+ 5
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/question/QuestionMapper.java View File

@@ -7,6 +7,7 @@ import com.xhkjedu.sstudy.vo.question.SelectQuestionVo;
7 7
 import org.apache.ibatis.annotations.Param;
8 8
 
9 9
 import java.util.List;
10
+import java.util.Map;
10 11
 
11 12
 public interface QuestionMapper extends TkMapper<TQuestion> {
12 13
     /**
@@ -62,6 +63,8 @@ public interface QuestionMapper extends TkMapper<TQuestion> {
62 63
      * @return com.xhkjedu.model.question.TQuestion
63 64
      **/
64 65
     QuestionVo findById(@Param("questionid") String questionid);
66
+    //复合题子题
67
+    List<Map> listSonQuestionsForDetail(@Param("questionid") String questionid);
65 68
 
66 69
     /**
67 70
      * 章节、知识点选题
@@ -70,7 +73,8 @@ public interface QuestionMapper extends TkMapper<TQuestion> {
70 73
      * @Date 2020/6/9 15:00
71 74
      * @return java.util.List<com.xhkjedu.vo.question.SelectQuestionVo>
72 75
      **/
73
-    List<SelectQuestionVo> listForSelect(@Param("question") TQuestion question);
76
+    List<Map> listForSelect(@Param("question") TQuestion question);
77
+
74 78
 
75 79
     /**
76 80
      * 更新组题次数

+ 9
- 3
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionService.java View File

@@ -55,7 +55,13 @@ public class QuestionService {
55 55
 
56 56
     //获取详情
57 57
     public QuestionVo findById(String questionid) {
58
-        return questionMapper.findById(questionid);
58
+        QuestionVo questionVo = questionMapper.findById(questionid);
59
+        if(questionVo.getQlevel() == 2){
60
+            //代表母题,需要获取子题
61
+            List<Map> sonqlist = questionMapper.listSonQuestionsForDetail(questionVo.getQuestionid());
62
+            questionVo.setSonqlist(sonqlist);
63
+        }
64
+        return questionVo;
59 65
     }
60 66
 
61 67
     //获取列表
@@ -260,9 +266,9 @@ public class QuestionService {
260 266
      * @Param [question]
261 267
      * @Author ywx
262 268
      * @Date 2020/6/9 15:00
263
-     * @return java.util.List<com.xhkjedu.vo.question.SelectQuestionVo>
269
+     * @return java.util.List<Map>
264 270
      **/
265
-    public List<SelectQuestionVo> listForSelect(TQuestion question) {
271
+    public List<Map> listForSelect(TQuestion question) {
266 272
         return questionMapper.listForSelect(question);
267 273
     }
268 274
 

+ 1
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/QuestionVo.java View File

@@ -118,5 +118,5 @@ public class QuestionVo {
118 118
     private List<Map> classes;
119 119
 
120 120
     //子题
121
-    private List<QuestionVo> sonqlist;
121
+    private List<Map> sonqlist;
122 122
 }

+ 43
- 4
sstudy/src/main/resources/mapper/question/QuestionMapper.xml View File

@@ -78,6 +78,7 @@
78 78
         <result property="schoolid" column="schoolid"></result>
79 79
         <result property="subjectid" column="subjectid"></result>
80 80
         <result property="areaall" column="areaall"></result>
81
+        <result property="qlevel" column="qlevel"></result>
81 82
         <collection property="points" ofType="com.xhkjedu.sstudy.vo.subjectbook.PointVo" javaType="java.util.List"
82 83
                     select="listPoint" column="{questionid=questionid}">
83 84
         </collection>
@@ -115,7 +116,7 @@
115 116
     <select id="findById" resultMap="questionResult">
116 117
         select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong
117 118
         ,q.qtypeid,q.qtypename,q.createtime,q.source,q.year,q.region,q.schoolname,q.subjectid,q.schoolid
118
-        ,qd.directorid,d.directorall directorname,d.lsbid,q.hearfile
119
+        ,qd.directorid,d.directorall directorname,d.lsbid,q.hearfile,q.qlevel,
119 120
         sb.level,sb.subjectid,s.subjectname,v.versionname,sb.lsbname
120 121
         ,(select a.areaall from t_areazone a where a.areacode=q.region)areaall
121 122
         from t_question q left join t_question_director qd on q.questionid=qd.questionid
@@ -125,10 +126,15 @@
125 126
         left join t_version v on sb.versionid = v.versionid
126 127
         where q.questionid=#{questionid}
127 128
     </select>
129
+    <select id="listSonQuestionsForDetail" resultType="java.util.Map">
130
+        select q.questionid,q.score,q.complexity,q.qstem,q.qoption,q.qanswer,q.qanalyze
131
+             ,q.qtypeid,q.qtypename,q.ctype,q.qlevel,q.sorder
132
+        from t_question q where q.qlevel=3 and q.questionpid=#{questionid} order by q.sorder
133
+    </select>
128 134
     <!--管理端试题列表-->
129 135
     <select id="findAll" resultType="com.xhkjedu.sstudy.vo.question.QuestionVo">
130 136
         select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong,q.createid
131
-        ,q.qtypeid,q.qtypename,q.createtime,q.count,q.qstate,q.source,q.year,q.region,q.schoolname,q.hearfile
137
+        ,q.qtypeid,q.qtypename,q.createtime,q.count,q.qstate,q.source,q.year,q.region,q.schoolname,q.hearfile,q.qlevel
132 138
         from t_question q left join t_question_director qd on q.questionid=qd.questionid
133 139
         <if test="question.belong!=null and question.belong==5">
134 140
             left join t_question_collect qc on q.questionid = qc.questionid
@@ -186,10 +192,37 @@
186 192
         </where>
187 193
         group by q.questionid order by q.qstate,q.createtime desc
188 194
     </select>
195
+
196
+    <!--章节、知识点选题-->
197
+    <resultMap id="directPointQuestions" type="java.util.Map">
198
+        <result property="questionid" column="questionid"></result>
199
+        <result property="score" column="score"></result>
200
+        <result property="complexity" column="complexity"></result>
201
+        <result property="qstem" column="qstem"></result>
202
+        <result property="qoption" column="qoption"></result>
203
+        <result property="qanswer" column="qanswer"></result>
204
+        <result property="qanalyze" column="qanalyze"></result>
205
+        <result property="qtypeid" column="qtypeid"></result>
206
+        <result property="qtypename" column="qtypename"></result>
207
+        <result property="count" column="count"></result>
208
+        <result property="points" column="points"></result>
209
+        <result property="ctype" column="ctype"></result>
210
+        <result property="source" column="source"></result>
211
+        <result property="year" column="year"></result>
212
+        <result property="region" column="region"></result>
213
+        <result property="schoolname" column="schoolname"></result>
214
+        <result property="qlevel" column="qlevel"></result>
215
+        <result property="snum" column="snum"></result>
216
+        <result property="hearfile" column="hearfile"></result>
217
+        <collection property="sonqlist" ofType="java.util.Map"
218
+                    column="questionid" select="listSonQuestionForSelect">
219
+        </collection>
220
+    </resultMap>
221
+
189 222
     <!--章节、知识点选题-->
190
-    <select id="listForSelect" resultType="com.xhkjedu.sstudy.vo.question.SelectQuestionVo">
223
+    <select id="listForSelect" resultMap="directPointQuestions">
191 224
         select q.questionid,q.score,q.complexity,q.qstem,q.qoption,q.qanswer,q.qanalyze
192
-        ,q.qtypeid,q.qtypename,q.count,GROUP_CONCAT(p.pointname)points,q.ctype,q.belong,q.createid
225
+        ,q.qtypeid,q.qtypename,q.count,GROUP_CONCAT(p.pointname)points,q.ctype
193 226
         ,q.source,q.year,q.region,q.schoolname,q.qlevel,q.hearfile
194 227
         from t_question q left join t_question_point qp on q.questionid = qp.questionid
195 228
         left join t_point p on p.pointid=qp.pointid
@@ -246,6 +279,12 @@
246 279
         and q.qlevel &lt; 3
247 280
         group by q.questionid order by q.createtime desc
248 281
     </select>
282
+
283
+    <select id="listSonQuestionForSelect" resultType="java.util.Map">
284
+        select q.questionid,q.score,q.complexity,q.qstem,q.qoption,q.qanswer,q.qanalyze
285
+        ,q.qtypeid,q.qtypename,q.ctype,q.qlevel,q.sorder
286
+        from t_question q where q.qlevel=3 and q.questionpid=#{questionid} order by q.sorder
287
+    </select>
249 288
     <!--修改试题状态-->
250 289
     <update id="updateQuestionState">
251 290
         update t_question set qstate=#{qstate} where questionid in (${questionIds})

Loading…
Cancel
Save