Browse Source

举一反三随机取3条数据

tags/正式3.2.0
王宁 2 years ago
parent
commit
abe6e0f7da

+ 6
- 4
sstudy/src/main/resources/mapper/question/QuestionClassMapper.xml View File

39
     <select id="directorList" resultType="com.xhkjedu.sstudy.vo.question.QuestionClassVo">
39
     <select id="directorList" resultType="com.xhkjedu.sstudy.vo.question.QuestionClassVo">
40
         select qc.questionid,qc.qscore,qc.avgscore,qc.errorrate,qc.qctype,qc.qtypeid
40
         select qc.questionid,qc.qscore,qc.avgscore,qc.errorrate,qc.qctype,qc.qtypeid
41
         ,concat(p.papername,'-第',qc.qorder,'题')qstem
41
         ,concat(p.papername,'-第',qc.qorder,'题')qstem
42
-        from (select max(qcid)qcid,questionid from t_question_class where classid=#{question.classid} group by questionid)a
42
+        from (select max(qcid)qcid,questionid from t_question_class where classid=#{question.classid} group by
43
+        questionid)a
43
         left join t_question_class qc on a.qcid=qc.qcid
44
         left join t_question_class qc on a.qcid=qc.qcid
44
         left join t_paper p on qc.paperid=p.paperid
45
         left join t_paper p on qc.paperid=p.paperid
45
         where qc.classid=#{question.classid} and qc.qctype in(1,2)
46
         where qc.classid=#{question.classid} and qc.qctype in(1,2)
75
     <select id="pointList" resultType="com.xhkjedu.sstudy.vo.question.QuestionClassVo">
76
     <select id="pointList" resultType="com.xhkjedu.sstudy.vo.question.QuestionClassVo">
76
         select qc.questionid,qc.qscore,qc.avgscore,qc.errorrate,qc.qctype
77
         select qc.questionid,qc.qscore,qc.avgscore,qc.errorrate,qc.qctype
77
         ,q.ctype,q.qstem,q.qoption,q.qtypeid,q.qtypename,q.count
78
         ,q.ctype,q.qstem,q.qoption,q.qtypeid,q.qtypename,q.count
78
-        from (select max(qcid)qcid,questionid from t_question_class where classid=#{question.classid} group by questionid)a
79
+        from (select max(qcid)qcid,questionid from t_question_class where classid=#{question.classid} group by
80
+        questionid)a
79
         left join t_question_class qc on a.qcid=qc.qcid
81
         left join t_question_class qc on a.qcid=qc.qcid
80
         left join t_paper p on qc.paperid=p.paperid
82
         left join t_paper p on qc.paperid=p.paperid
81
         left join t_question q on qc.questionid=q.questionid
83
         left join t_question q on qc.questionid=q.questionid
243
     <select id="getPointIds" resultType="java.lang.String">
245
     <select id="getPointIds" resultType="java.lang.String">
244
         select concat("'",group_concat(pointid separator "','"),"'") from t_question_point where questionid=#{questionid}
246
         select concat("'",group_concat(pointid separator "','"),"'") from t_question_point where questionid=#{questionid}
245
     </select>
247
     </select>
246
-    <!--举一反三试题列表-->
248
+    <!--举一反三试题列表(随机返回3条)-->
247
     <select id="listJYFSQuestion" resultType="java.util.Map">
249
     <select id="listJYFSQuestion" resultType="java.util.Map">
248
         select q.questionid,q.qtypeid,q.qtypename,q.complexity,q.count,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.ctype
250
         select q.questionid,q.qtypeid,q.qtypename,q.complexity,q.count,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.ctype
249
         ,(select count(*) from t_question_collect qc where qc.questionid=q.questionid)collected
251
         ,(select count(*) from t_question_collect qc where qc.questionid=q.questionid)collected
253
         left join t_point p on tqp.pointid=p.pointid
255
         left join t_point p on tqp.pointid=p.pointid
254
         where qp.pointid in(${pointIds}) and qp.questionid!=#{questionid} and q.qstate=1
256
         where qp.pointid in(${pointIds}) and qp.questionid!=#{questionid} and q.qstate=1
255
         and (q.belong in(1,2) or (q.schoolid=#{schoolid} and q.belong=3) or (q.createid=#{userid} and q.belong=4))
257
         and (q.belong in(1,2) or (q.schoolid=#{schoolid} and q.belong=3) or (q.createid=#{userid} and q.belong=4))
256
-        group by qp.questionid order by rand() limit 30
258
+        group by qp.questionid order by rand() limit 3
257
     </select>
259
     </select>
258
 
260
 
259
     <!-- 根据作业id获取作业附件 -->
261
     <!-- 根据作业id获取作业附件 -->

Loading…
Cancel
Save