瀏覽代碼

添加获取批量试题知识点

tags/正式3.11.0
王宁 1 年之前
父節點
當前提交
a6ae503d63

+ 17
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/controller/question/QuestionController.java 查看文件

@@ -197,4 +197,21 @@ public class QuestionController {
197 197
         return new ResultVo(0,"获取分享的伙伴校成功",list);
198 198
     }
199 199
 
200
+    /*
201
+     * @Description获取一组试题知识点
202
+     * @Date 2023/8/31 15:26:40
203
+     * @Author WN
204
+     * @Param [questionids]
205
+     * @Return com.xhkjedu.vo.ResultVo
206
+     **/
207
+    @PostMapping("/qids_points")
208
+    public ResultVo listQuestionPoints(@RequestBody List<String> questionids) {
209
+        if(N_Utils.isListEmpty(questionids)){
210
+            return new ResultVo(1,"试题id不能为空");
211
+        }else{
212
+            List<Map> qlist = tQuestionService.listQuestionPoints(questionids);
213
+            return new ResultVo(0,"获取成功",qlist);
214
+        }
215
+    }
216
+
200 217
 }

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/question/QuestionPointMapper.java 查看文件

@@ -20,4 +20,7 @@ public interface QuestionPointMapper extends TkMapper<TQuestionPoint> {
20 20
     void batchSave(@Param("list") List<TQuestionPoint> questionPoints);
21 21
 
22 22
     List<Map> listPointsByQuestionid(@Param("questionid") String questionid);
23
+
24
+    //试题关联知识点
25
+    List<Map> listQuestionPoints(@Param("questionids") List<String> questionids);
23 26
 }

+ 11
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionService.java 查看文件

@@ -559,4 +559,15 @@ public class QuestionService {
559 559
     public List<Map<String, Object>> listSharePartnerSchool(String questionid) {
560 560
         return questionMapper.listSharePartnerSchool(questionid);
561 561
     }
562
+
563
+    /*
564
+     * @Description 根据试题ids获取对应知识点集合
565
+     * @Date 2023/8/31 15:13:28
566
+     * @Author WN
567
+     * @Param [questionids]
568
+     * @Return java.util.List<java.util.Map>
569
+     **/
570
+    public List<Map> listQuestionPoints(List<String> questionids) {
571
+        return questionPointMapper.listQuestionPoints(questionids);
572
+    }
562 573
 }

+ 18
- 0
sstudy/src/main/resources/mapper/question/QuestionPointMapper.xml 查看文件

@@ -20,4 +20,22 @@
20 20
         left join t_point p on qp.pointid=p.pointid
21 21
         where qp.questionid=#{questionid} order by p.pointorder
22 22
     </select>
23
+
24
+    <!--试题关联知识点-->
25
+    <resultMap id="questionPoints" type="java.util.Map">
26
+        <result property="questionid" column="questionid" />
27
+        <collection property="pointList" javaType="java.util.List" ofType="java.util.Map">
28
+            <result property="pointid" column="pointid" />
29
+            <result property="pointname" column="pointname" />
30
+        </collection>
31
+    </resultMap>
32
+    <select id="listQuestionPoints" resultMap="questionPoints">
33
+        select qp.questionid,qp.pointid,p.pointname from t_question_point qp
34
+        left join t_point p on qp.pointid=p.pointid
35
+        where qp.questionid in
36
+        <foreach collection="questionids" item="q" separator="," open="(" close=")">
37
+            #{q}
38
+        </foreach>
39
+        order by p.pointorder
40
+    </select>
23 41
 </mapper>

Loading…
取消
儲存