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

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

7
 import org.apache.ibatis.annotations.Param;
7
 import org.apache.ibatis.annotations.Param;
8
 
8
 
9
 import java.util.List;
9
 import java.util.List;
10
+import java.util.Map;
10
 
11
 
11
 public interface QuestionMapper extends TkMapper<TQuestion> {
12
 public interface QuestionMapper extends TkMapper<TQuestion> {
12
     /**
13
     /**
62
      * @return com.xhkjedu.model.question.TQuestion
63
      * @return com.xhkjedu.model.question.TQuestion
63
      **/
64
      **/
64
     QuestionVo findById(@Param("questionid") String questionid);
65
     QuestionVo findById(@Param("questionid") String questionid);
66
+    //复合题子题
67
+    List<Map> listSonQuestionsForDetail(@Param("questionid") String questionid);
65
 
68
 
66
     /**
69
     /**
67
      * 章节、知识点选题
70
      * 章节、知识点选题
70
      * @Date 2020/6/9 15:00
73
      * @Date 2020/6/9 15:00
71
      * @return java.util.List<com.xhkjedu.vo.question.SelectQuestionVo>
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
 
55
 
56
     //获取详情
56
     //获取详情
57
     public QuestionVo findById(String questionid) {
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
      * @Param [question]
266
      * @Param [question]
261
      * @Author ywx
267
      * @Author ywx
262
      * @Date 2020/6/9 15:00
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
         return questionMapper.listForSelect(question);
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
     private List<Map> classes;
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
         <result property="schoolid" column="schoolid"></result>
78
         <result property="schoolid" column="schoolid"></result>
79
         <result property="subjectid" column="subjectid"></result>
79
         <result property="subjectid" column="subjectid"></result>
80
         <result property="areaall" column="areaall"></result>
80
         <result property="areaall" column="areaall"></result>
81
+        <result property="qlevel" column="qlevel"></result>
81
         <collection property="points" ofType="com.xhkjedu.sstudy.vo.subjectbook.PointVo" javaType="java.util.List"
82
         <collection property="points" ofType="com.xhkjedu.sstudy.vo.subjectbook.PointVo" javaType="java.util.List"
82
                     select="listPoint" column="{questionid=questionid}">
83
                     select="listPoint" column="{questionid=questionid}">
83
         </collection>
84
         </collection>
115
     <select id="findById" resultMap="questionResult">
116
     <select id="findById" resultMap="questionResult">
116
         select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong
117
         select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong
117
         ,q.qtypeid,q.qtypename,q.createtime,q.source,q.year,q.region,q.schoolname,q.subjectid,q.schoolid
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
         sb.level,sb.subjectid,s.subjectname,v.versionname,sb.lsbname
120
         sb.level,sb.subjectid,s.subjectname,v.versionname,sb.lsbname
120
         ,(select a.areaall from t_areazone a where a.areacode=q.region)areaall
121
         ,(select a.areaall from t_areazone a where a.areacode=q.region)areaall
121
         from t_question q left join t_question_director qd on q.questionid=qd.questionid
122
         from t_question q left join t_question_director qd on q.questionid=qd.questionid
125
         left join t_version v on sb.versionid = v.versionid
126
         left join t_version v on sb.versionid = v.versionid
126
         where q.questionid=#{questionid}
127
         where q.questionid=#{questionid}
127
     </select>
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
     <select id="findAll" resultType="com.xhkjedu.sstudy.vo.question.QuestionVo">
135
     <select id="findAll" resultType="com.xhkjedu.sstudy.vo.question.QuestionVo">
130
         select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong,q.createid
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
         from t_question q left join t_question_director qd on q.questionid=qd.questionid
138
         from t_question q left join t_question_director qd on q.questionid=qd.questionid
133
         <if test="question.belong!=null and question.belong==5">
139
         <if test="question.belong!=null and question.belong==5">
134
             left join t_question_collect qc on q.questionid = qc.questionid
140
             left join t_question_collect qc on q.questionid = qc.questionid
186
         </where>
192
         </where>
187
         group by q.questionid order by q.qstate,q.createtime desc
193
         group by q.questionid order by q.qstate,q.createtime desc
188
     </select>
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
         select q.questionid,q.score,q.complexity,q.qstem,q.qoption,q.qanswer,q.qanalyze
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
         ,q.source,q.year,q.region,q.schoolname,q.qlevel,q.hearfile
226
         ,q.source,q.year,q.region,q.schoolname,q.qlevel,q.hearfile
194
         from t_question q left join t_question_point qp on q.questionid = qp.questionid
227
         from t_question q left join t_question_point qp on q.questionid = qp.questionid
195
         left join t_point p on p.pointid=qp.pointid
228
         left join t_point p on p.pointid=qp.pointid
246
         and q.qlevel &lt; 3
279
         and q.qlevel &lt; 3
247
         group by q.questionid order by q.createtime desc
280
         group by q.questionid order by q.createtime desc
248
     </select>
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
     <update id="updateQuestionState">
289
     <update id="updateQuestionState">
251
         update t_question set qstate=#{qstate} where questionid in (${questionIds})
290
         update t_question set qstate=#{qstate} where questionid in (${questionIds})

Loading…
Cancel
Save