Browse Source

错题集

tags/正式版本
雍文秀 2 years ago
parent
commit
18bc1891ce

+ 17
- 0
scommons/src/main/java/com/xhkjedu/utils/N_Utils.java View File

@@ -1067,4 +1067,21 @@ public class N_Utils {
1067 1067
             return false;
1068 1068
         }
1069 1069
     }
1070
+
1071
+    //处理题型中复合题
1072
+    private static int[] cctypelist = new int[]{11,16,17};
1073
+    /*
1074
+     * 判断ctype是否是复合题
1075
+     * @Param [ctype]
1076
+     * @Author ywx
1077
+     * @Date 2022/10/18 19:11
1078
+     * @return boolean
1079
+     **/
1080
+    public static boolean isComplexQuestion(Integer ctype){
1081
+        if(ctype != null && ctype != 0){
1082
+            return IntStream.of(cctypelist).anyMatch(x -> x == ctype);
1083
+        }else{
1084
+            return false;
1085
+        }
1086
+    }
1070 1087
 }

+ 18
- 6
sstudy/src/main/java/com/xhkjedu/sstudy/controller/question/QuestionClassController.java View File

@@ -104,20 +104,18 @@ public class QuestionClassController {
104 104
 
105 105
     @PostMapping("/objective_detail")
106 106
     public ResultVo objectiveDetail(@RequestBody TQuestionClass question) {
107
-        String questionid = question.getQuestionid();
108 107
         Integer qctype = question.getQctype();
109
-        Integer classid = question.getClassid();
110
-        N_Utils.validation(new Object[]{questionid,"试题id",2,qctype,"试题类型",1,classid,"班级id",1});
108
+        Integer qcid = question.getQcid();
109
+        N_Utils.validation(new Object[]{qctype,"试题类型",1,qcid,"班级错题id",1});
111 110
         QuestionClassDetailVo detail = questionClassService.objectiveDetail(question);
112 111
         return new ResultVo(0,"获取客观题详情成功",detail);
113 112
     }
114 113
 
115 114
     @PostMapping("/subjective_detail")
116 115
     public ResultVo subjectiveDetail(@RequestBody TQuestionClass question) {
117
-        String questionid = question.getQuestionid();
118 116
         Integer qctype = question.getQctype();
119
-        Integer classid = question.getClassid();
120
-        N_Utils.validation(new Object[]{questionid,"试题id",2,qctype,"试题类型",1,classid,"班级id",1});
117
+        Integer qcid = question.getQcid();
118
+        N_Utils.validation(new Object[]{qctype,"试题类型",1,qcid,"班级错题id",1});
121 119
         QuestionClassDetailVo detail = questionClassService.subjectiveDetail(question);
122 120
         return new ResultVo(0,"获取主观题详情成功",detail);
123 121
     }
@@ -148,4 +146,18 @@ public class QuestionClassController {
148 146
         List<Map> list = questionClassService.listJYFSQuestion(questionid,userid,schoolid);
149 147
         return new ResultVo(0,"获取举一反三试题列表成功",list);
150 148
     }
149
+
150
+    /*
151
+     * 复合题详情
152
+     * @Param [question]
153
+     * @Author ywx
154
+     * @Date 2022/10/19 11:30
155
+     * @return com.xhkjedu.vo.ResultVo
156
+     **/
157
+    @PostMapping("/complex_detail")
158
+    public ResultVo complexDetail(@RequestBody TQuestionClass question) {
159
+        N_Utils.validation(new Object[]{question.getQcid(), "班级错题id", 1});
160
+        QuestionClassDetailVo detail = questionClassService.complexDetail(question);
161
+        return new ResultVo(0, "获取复合题详情成功", detail);
162
+    }
151 163
 }

+ 10
- 9
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/question/QuestionClassMapper.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.sstudy.mapper.question;
2 2
 
3 3
 import com.xhkjedu.sstudy.base.TkMapper;
4 4
 import com.xhkjedu.sstudy.model.question.TQuestionClass;
5
+import com.xhkjedu.sstudy.vo.paperstudent.PaperStudentQuestionVo;
5 6
 import com.xhkjedu.sstudy.vo.question.QuestionClassDetailVo;
6 7
 import com.xhkjedu.sstudy.vo.question.QuestionClassVo;
7 8
 import com.xhkjedu.sstudy.vo.subjectbook.SubjectQuestiontypeVo;
@@ -44,15 +45,6 @@ public interface QuestionClassMapper extends TkMapper<TQuestionClass> {
44 45
     //答题卡主观题详情
45 46
     QuestionClassDetailVo subjectiveSDetail(@Param("question") TQuestionClass question);
46 47
 
47
-    //考试统计按题
48
-    List<TQuestionClass> getEQuestionAnalyze(Long paperid, Integer classid);
49
-
50
-    //考试客观题详情
51
-    QuestionClassDetailVo objectiveEDetail(TQuestionClass question);
52
-
53
-    //考试主观题详情
54
-    QuestionClassDetailVo subjectiveEDetail(TQuestionClass question);
55
-
56 48
     //获取班级下作业总人数
57 49
     Integer getTotalnum(Long paperid, Integer classid, Integer qctype);
58 50
 
@@ -77,4 +69,13 @@ public interface QuestionClassMapper extends TkMapper<TQuestionClass> {
77 69
 
78 70
     //获取试题关联知识点
79 71
     String getPointName(String questionid);
72
+
73
+    //复合题详情
74
+    QuestionClassDetailVo complexDetail(@Param("question") TQuestionClass question);
75
+
76
+    //班级作业学生
77
+    List<Map> listStus(@Param("question") QuestionClassDetailVo question);
78
+
79
+    //班级作业学生作答情况
80
+    List<PaperStudentQuestionVo> listStusAnswer(@Param("question") QuestionClassDetailVo question);
80 81
 }

+ 84
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionClassService.java View File

@@ -7,6 +7,7 @@ import com.xhkjedu.sstudy.mapper.paper.PaperMapper;
7 7
 import com.xhkjedu.sstudy.mapper.paperstudent.PaperGroupMapper;
8 8
 import com.xhkjedu.sstudy.mapper.question.QuestionClassMapper;
9 9
 import com.xhkjedu.sstudy.mapper.question.QuestionExplainMapper;
10
+import com.xhkjedu.sstudy.mapper.question.QuestionMapper;
10 11
 import com.xhkjedu.sstudy.model.paper.TPaper;
11 12
 import com.xhkjedu.sstudy.model.paperstudent.TPaperGroup;
12 13
 import com.xhkjedu.sstudy.model.question.TQuestionClass;
@@ -14,6 +15,7 @@ import com.xhkjedu.sstudy.model.question.TQuestionExplain;
14 15
 import com.xhkjedu.sstudy.model.question.TQuestionStudent;
15 16
 import com.xhkjedu.sstudy.utils.ArithUtil;
16 17
 import com.xhkjedu.sstudy.utils.StudyUtil;
18
+import com.xhkjedu.sstudy.vo.paperstudent.PaperStudentQuestionVo;
17 19
 import com.xhkjedu.sstudy.vo.question.AnswerStu;
18 20
 import com.xhkjedu.sstudy.vo.question.QuestionClassDetailVo;
19 21
 import com.xhkjedu.sstudy.vo.question.QuestionClassVo;
@@ -28,6 +30,7 @@ import org.springframework.util.MultiValueMap;
28 30
 
29 31
 import javax.annotation.Resource;
30 32
 import java.util.ArrayList;
33
+import java.util.Comparator;
31 34
 import java.util.List;
32 35
 import java.util.Map;
33 36
 import java.util.stream.Collectors;
@@ -52,6 +55,8 @@ public class QuestionClassService {
52 55
     private PaperMapper paperMapper;
53 56
     @Autowired
54 57
     private MessageSender messageSender;
58
+    @Resource
59
+    private QuestionMapper questionMapper;
55 60
 
56 61
     /**
57 62
      * 提交作业:全部批阅的作业调用批阅完成方法
@@ -227,7 +232,7 @@ public class QuestionClassService {
227 232
             List<Map> files = questionClassMapper.listObjsByPaperid(detail.getPaperid(), qctype);
228 233
             detail.setFiles(files);
229 234
         }
230
-        Integer totalnum = questionClassMapper.getTotalnum(detail.getPaperid(), question.getClassid(),qctype);
235
+        Integer totalnum = questionClassMapper.getTotalnum(detail.getPaperid(), detail.getClassid(),qctype);
231 236
         Integer ytjnum = 0;
232 237
         List<AnswerStu> stus = detail.getStus();
233 238
         for (AnswerStu s : stus) {
@@ -357,6 +362,10 @@ public class QuestionClassService {
357 362
         List<Map> list = questionClassMapper.listJYFSQuestion(pointIds, questionid, userid, schoolid);
358 363
         for (Map map : list) {
359 364
             questionid = map.get("questionid").toString();
365
+            if (N_Utils.isComplexQuestion((Integer) map.get("ctype"))) {
366
+                List<Map> sonqlist = questionMapper.listSonQuestionsForDetail(questionid);
367
+                map.put("sonqlist", sonqlist);
368
+            }
360 369
             Integer collected = questionClassMapper.getCollected(questionid, userid);
361 370
             map.put("collected",collected);
362 371
             String pointname = questionClassMapper.getPointName(questionid);
@@ -364,4 +373,78 @@ public class QuestionClassService {
364 373
         }
365 374
         return list;
366 375
     }
376
+
377
+    //复合题详情
378
+    public QuestionClassDetailVo complexDetail(TQuestionClass question) {
379
+        QuestionClassDetailVo detail = questionClassMapper.complexDetail(question);
380
+        List<Map> students = questionClassMapper.listStus(detail);//班级作业学生
381
+        Integer totalnum = students.size();
382
+        Map<Integer, String> stuMap = students.stream().collect(Collectors.toMap(m -> (Integer) m.get("studentid"), m -> m.get("username").toString()));
383
+        List<PaperStudentQuestionVo> answers = questionClassMapper.listStusAnswer(detail);//班级作业学生作答情况
384
+        List<Map> sonqlist = questionMapper.listSonQuestionsForDetail(detail.getQuestionid());
385
+        for (Map q : sonqlist) {
386
+            String questionid = q.get("questionid").toString();
387
+            Integer ctype = (Integer) q.get("ctype");
388
+            List<AnswerStu> stus = new ArrayList<>();
389
+            List<PaperStudentQuestionVo> alist = answers.stream().filter(a -> a.getQuestionid().equals(questionid)).collect(Collectors.toList());
390
+            if (N_Utils.isListEmpty(alist)) {//没有学生作答处理下一题
391
+                q.put("stus", stus);
392
+                continue;
393
+            }
394
+            alist.forEach(a -> a.setStudentname(stuMap.get(a.getStudentid())));//学生姓名赋值
395
+            if (N_Utils.isObjectiveQuestion(ctype)) {//客观题
396
+                Map<String, List<PaperStudentQuestionVo>> collect = alist.stream().collect(Collectors.groupingBy(a -> a.getUseranswer()));
397
+                for (Map.Entry<String, List<PaperStudentQuestionVo>> entry : collect.entrySet()) {
398
+                    String section = entry.getKey();
399
+                    List<PaperStudentQuestionVo> list = entry.getValue();
400
+                    AnswerStu stu = new AnswerStu();
401
+                    stu.setSection(section);
402
+                    Integer stunum = list.size();
403
+                    stu.setStunum(stunum);
404
+                    stu.setStuscale(N_Utils.floorDiv(stunum, totalnum));
405
+                    String stuname = list.stream().map(s -> s.getStudentname()).sorted().collect(Collectors.joining("  "));
406
+                    stu.setStuname(stuname);
407
+                    stus.add(stu);
408
+                }
409
+                stus = stus.stream().sorted(Comparator.comparing(AnswerStu::getSection)).collect(Collectors.toList());
410
+            } else {//主观题
411
+                Double qscore = alist.get(0).getQscore();
412
+                Double ascore = ArithUtil.mul(qscore, 0.25);//0~25%档最高得分
413
+                Double bscore = ArithUtil.mul(qscore, 0.5);//26%~50%档最高得分
414
+                Double cscore = ArithUtil.mul(qscore, 0.75);//51%~75%档最高得分
415
+                Integer anum = 0;//0~25%档人数
416
+                Integer bnum = 0;//26%~50%档人数
417
+                Integer cnum = 0;//51%~75%档人数
418
+                Integer dnum = 0;//76%~100%档人数
419
+                List<String> aname = new ArrayList<>();//0~25%档学生名单
420
+                List<String> bname = new ArrayList<>();//26%~50%档学生名单
421
+                List<String> cname = new ArrayList<>();//51%~75%档学生名单
422
+                List<String> dname = new ArrayList<>();//76%~100%档学生名单
423
+                for (PaperStudentQuestionVo s : alist) {
424
+                    Double stuscore = s.getStuscore();
425
+                    String stuname = s.getStudentname();
426
+                    if (stuscore.compareTo(ascore) != 1) {
427
+                        anum++;
428
+                        aname.add(stuname);
429
+                    } else if (stuscore.compareTo(bscore) != 1) {
430
+                        bnum++;
431
+                        bname.add(stuname);
432
+                    } else if (stuscore.compareTo(cscore) != 1) {
433
+                        cnum++;
434
+                        cname.add(stuname);
435
+                    } else {
436
+                        dnum++;
437
+                        dname.add(stuname);
438
+                    }
439
+                }
440
+                stus.add(new AnswerStu("0~25%", anum, N_Utils.floorDiv(anum, totalnum), 0.0, StringUtils.join(aname, "  ")));
441
+                stus.add(new AnswerStu("26%~50%", bnum, N_Utils.floorDiv(bnum, totalnum), 0.0, StringUtils.join(bname, "  ")));
442
+                stus.add(new AnswerStu("51%~75%", cnum, N_Utils.floorDiv(cnum, totalnum), 0.0, StringUtils.join(cname, "  ")));
443
+                stus.add(new AnswerStu("76%~100%", dnum, N_Utils.floorDiv(dnum, totalnum), 0.0, StringUtils.join(dname, "  ")));
444
+            }
445
+            q.put("stus", stus);
446
+        }
447
+        detail.setSonqlist(sonqlist);
448
+        return detail;
449
+    }
367 450
 }

+ 7
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/service/question/QuestionStudentService.java View File

@@ -3,6 +3,7 @@ package com.xhkjedu.sstudy.service.question;
3 3
 import com.xhkjedu.sstudy.mapper.paper.PaperFileMapper;
4 4
 import com.xhkjedu.sstudy.mapper.question.QuestionClassMapper;
5 5
 import com.xhkjedu.sstudy.mapper.question.QuestionExplainMapper;
6
+import com.xhkjedu.sstudy.mapper.question.QuestionMapper;
6 7
 import com.xhkjedu.sstudy.mapper.question.QuestionStudentMapper;
7 8
 import com.xhkjedu.sstudy.model.paper.TPaperFile;
8 9
 import com.xhkjedu.sstudy.model.question.TQuestionExplain;
@@ -39,6 +40,8 @@ public class QuestionStudentService {
39 40
     private PaperFileMapper paperFileMapper;
40 41
     @Resource
41 42
     private QuestionClassMapper questionClassMapper;
43
+    @Resource
44
+    private QuestionMapper questionMapper;
42 45
 
43 46
     //添加
44 47
     public Integer save(TQuestionStudent model) {
@@ -234,6 +237,10 @@ public class QuestionStudentService {
234 237
         QuestionStudentVo question = null;
235 238
         if (qctype == 1 || qctype == 3) {
236 239
             question = questionStudentMapper.detail(questionid, studentid, qctype);
240
+            if (N_Utils.isComplexQuestion(question.getCtype())) {
241
+                List<Map> sonqlist = questionMapper.listSonQuestionsForDetail(questionid);
242
+                question.setSonqlist(sonqlist);
243
+            }
237 244
         } else {
238 245
             question = questionStudentMapper.sdetail(questionid, studentid);
239 246
             if (question != null) {

+ 4
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/QuestionClassDetailVo.java View File

@@ -60,6 +60,10 @@ public class QuestionClassDetailVo {
60 60
 
61 61
     //作业附件
62 62
     private List<Map> files;
63
+
64
+    private List<Map> sonqlist;//子题
65
+
66
+    private Integer classid;//班级id
63 67
 }
64 68
 
65 69
 /**

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/QuestionClassVo.java View File

@@ -57,4 +57,7 @@ public class QuestionClassVo {
57 57
 
58 58
     //组题次数
59 59
     private Integer count;
60
+
61
+    //班级错题id
62
+    private Integer qcid;
60 63
 }

+ 3
- 0
sstudy/src/main/java/com/xhkjedu/sstudy/vo/question/QuestionStudentVo.java View File

@@ -5,6 +5,7 @@ import com.xhkjedu.sstudy.model.question.TQuestionExplain;
5 5
 import lombok.Data;
6 6
 
7 7
 import java.util.List;
8
+import java.util.Map;
8 9
 
9 10
 @Data
10 11
 public class QuestionStudentVo {
@@ -70,4 +71,6 @@ public class QuestionStudentVo {
70 71
 
71 72
     //难易度
72 73
     private Integer complexity;
74
+
75
+    private List<Map> sonqlist;//子题
73 76
 }

+ 36
- 55
sstudy/src/main/resources/mapper/question/QuestionClassMapper.xml View File

@@ -19,14 +19,6 @@
19 19
         where ps.paperid=#{paperid}
20 20
         group by ps.pscaid order by ps.psorder
21 21
     </select>
22
-    <!--考试统计按题-->
23
-    <select id="getEQuestionAnalyze" resultType="com.xhkjedu.sstudy.model.question.TQuestionClass">
24
-        select ps.pscaid questionid,ps.psorder qorder,ps.psscore qscore,sum(ifnull(pss.stuscore,0))stuscore,ps.schoolid,ps.ctype qtypeid
25
-        ,(select count(*) from t_classroom_paper_student ps where ps.paperid=#{paperid} and ps.classid=#{classid})stunum
26
-        from t_classroom_paper_scantron ps left join t_classroom_paper_student_scantron pss on ps.pscaid=pss.pscaid
27
-        where ps.paperid=#{paperid} and pss.classid=#{classid}
28
-        group by ps.pscaid order by ps.psorder
29
-    </select>
30 22
     <!--详情-->
31 23
     <select id="findById" resultType="com.xhkjedu.sstudy.vo.question.QuestionClassVo">
32 24
         select q.questionid,q.score,q.complexity,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.belong
@@ -38,7 +30,7 @@
38 30
     </select>
39 31
     <!--章节班级错题列表-->
40 32
     <select id="directorList" resultType="com.xhkjedu.sstudy.vo.question.QuestionClassVo">
41
-        select qc.questionid,qc.qscore,qc.avgscore,qc.errorrate,qc.qctype,qc.qtypeid
33
+        select qc.qcid,qc.questionid,qc.qscore,qc.avgscore,qc.errorrate,qc.qctype,qc.qtypeid
42 34
         ,concat(p.papername,'-第',qc.qorder,'题')qstem
43 35
         from (select max(qcid)qcid,questionid from t_question_class where classid=#{question.classid} group by
44 36
         questionid)a
@@ -81,7 +73,7 @@
81 73
     </select>
82 74
     <!--知识点班级错题列表-->
83 75
     <select id="pointList" resultType="com.xhkjedu.sstudy.vo.question.QuestionClassVo">
84
-        select qc.questionid,qc.qscore,qc.avgscore,qc.errorrate,qc.qctype
76
+        select qc.qcid,qc.questionid,qc.qscore,qc.avgscore,qc.errorrate,qc.qctype
85 77
         ,q.ctype,q.qstem,q.qoption,q.qtypeid,q.qtypename,q.count
86 78
         from (select max(qcid)qcid,questionid from t_question_class where classid=#{question.classid} group by
87 79
         questionid)a
@@ -165,39 +157,22 @@
165 157
         ,psq.useranswer section,count(psq.psqid)stunum,psq.stuscore,group_concat(u.username order by convert(u.username using gbk) separator '  ')stuname
166 158
         ,(select group_concat(p.pointname separator '  ') from t_question_point qp
167 159
         left join t_point p on qp.pointid = p.pointid where qp.questionid=q.questionid)pointname
168
-        from (select max(qcid)qcid,questionid from t_question_class
169
-        where questionid=#{question.questionid} and classid=#{question.classid} and qctype!=2)a
170
-        left join t_question_class qc on a.qcid=qc.qcid
171
-        left join t_question q on qc.questionid=q.questionid
160
+        from t_question_class qc left join t_question q on qc.questionid=q.questionid
172 161
         left join t_paper_student_question psq on qc.paperid=psq.paperid and qc.classid=psq.classid
173 162
         and qc.questionid=psq.questionid and (psq.answered=1 or psq.checked=1)
174 163
         left join t_user u on psq.studentid=u.userid
164
+        where qc.qcid=#{question.qcid}
175 165
         group by psq.useranswer
176 166
     </select>
177 167
     <!--答题卡客观题详情-->
178 168
     <select id="objectiveSDetail" resultMap="questionResult">
179 169
         select ps.psanswer qanswer,qc.qscore,qc.qctype,qc.avgscore,qc.errorrate,qc.paperid,qc.classid,qc.questionid
180 170
         ,pss.useranswer section,count(pss.pssid)stunum,pss.stuscore,group_concat(u.username order by convert(u.username using gbk) separator '  ')stuname
181
-        from (select max(qcid)qcid,questionid from t_question_class
182
-        where questionid=#{question.questionid} and classid=#{question.classid} and qctype=2)a
183
-        left join t_question_class qc on a.qcid=qc.qcid
184
-        left join t_paper_scantron ps on qc.questionid=ps.pscaid
171
+        from t_question_class qc left join t_paper_scantron ps on qc.questionid=ps.pscaid
185 172
         left join t_paper_student_scantron pss on ps.pscaid=pss.pscaid and (pss.answered=1 or pss.checked=1)
186
-        and pss.classid=#{question.classid}
187
-        left join t_user u on pss.studentid=u.userid
188
-        group by pss.useranswer
189
-    </select>
190
-    <!--考试客观题详情-->
191
-    <select id="objectiveEDetail" resultMap="questionResult">
192
-        select ps.psanswer qanswer,qc.qscore,qc.qctype,qc.avgscore,qc.errorrate,qc.paperid,qc.classid,qc.questionid
193
-        ,pss.useranswer section,count(pss.pssid)stunum,pss.stuscore,group_concat(u.username order by convert(u.username using gbk) separator '  ')stuname
194
-        from (select max(qcid)qcid,questionid from t_question_class
195
-        where questionid=#{question.questionid} and classid=#{question.classid} and qctype in(3,13,14,15))a
196
-        left join t_question_class qc on a.qcid=qc.qcid
197
-        left join t_classroom_paper_scantron ps on qc.questionid=ps.pscaid
198
-        left join t_classroom_paper_student_scantron pss on ps.pscaid=pss.pscaid and (pss.answered=1 or pss.checked=1)
199
-        and pss.classid=#{question.classid}
173
+        and pss.classid=qc.classid
200 174
         left join t_user u on pss.studentid=u.userid
175
+        where qc.qcid=#{question.qcid}
201 176
         group by pss.useranswer
202 177
     </select>
203 178
     <!--主观题详情-->
@@ -208,13 +183,11 @@
208 183
         ,(select count(*) from t_paper_student ps where ps.paperid=qc.paperid and ps.classid=qc.classid)wtjnum
209 184
         ,(select group_concat(p.pointname separator '  ') from t_question_point qp
210 185
         left join t_point p on qp.pointid = p.pointid where qp.questionid=q.questionid)pointname
211
-        from (select max(qcid)qcid,questionid from t_question_class
212
-        where questionid=#{question.questionid} and classid=#{question.classid} and qctype!=2)a
213
-        left join t_question_class qc on a.qcid=qc.qcid
214
-        left join t_question q on qc.questionid=q.questionid
186
+        from t_question_class qc left join t_question q on qc.questionid=q.questionid
215 187
         left join t_paper_student_question psq on qc.paperid=psq.paperid and qc.classid=psq.classid
216 188
         and qc.questionid=psq.questionid and (psq.answered=1 or psq.checked=1)
217 189
         left join t_user u on psq.studentid=u.userid
190
+        where qc.qcid=#{question.qcid}
218 191
         order by convert(u.username using gbk)
219 192
     </select>
220 193
     <!--答题卡主观题详情-->
@@ -222,27 +195,11 @@
222 195
         select ps.psanswer qanswer,qc.qscore,qc.qctype,qc.avgscore,qc.errorrate,qc.paperid,qc.classid,qc.questionid
223 196
         ,pss.stuscore,u.username stuname
224 197
         ,(select count(*) from t_paper_student ps where ps.paperid=qc.paperid and ps.classid=qc.classid)wtjnum
225
-        from (select max(qcid)qcid,questionid from t_question_class
226
-        where questionid=#{question.questionid} and classid=#{question.classid} and qctype=2)a
227
-        left join t_question_class qc on a.qcid=qc.qcid
228
-        left join t_paper_scantron ps on qc.questionid=ps.pscaid
198
+        from t_question_class qc left join t_paper_scantron ps on qc.questionid=ps.pscaid
229 199
         left join t_paper_student_scantron pss on ps.pscaid=pss.pscaid and (pss.answered=1 or pss.checked=1)
230
-        and pss.classid=#{question.classid}
231
-        left join t_user u on pss.studentid=u.userid
232
-        order by convert(u.username using gbk)
233
-    </select>
234
-    <!--考试主观题详情-->
235
-    <select id="subjectiveEDetail" resultMap="questionResult">
236
-        select ps.psanswer qanswer,qc.qscore,qc.qctype,qc.avgscore,qc.errorrate,qc.paperid,qc.classid,qc.questionid
237
-        ,pss.stuscore,u.username stuname
238
-        ,(select count(*) from t_classroom_paper_student ps where ps.paperid=qc.paperid and ps.classid=qc.classid)wtjnum
239
-        from (select max(qcid)qcid,questionid from t_question_class
240
-        where questionid=#{question.questionid} and classid=#{question.classid} and qctype in(3,13,14,15))a
241
-        left join t_question_class qc on a.qcid=qc.qcid
242
-        left join t_classroom_paper_scantron ps on qc.questionid=ps.pscaid
243
-        left join t_classroom_paper_student_scantron pss on ps.pscaid=pss.pscaid and (pss.answered=1 or pss.checked=1)
244
-        and pss.classid=#{question.classid}
200
+        and pss.classid=qc.classid
245 201
         left join t_user u on pss.studentid=u.userid
202
+        where qc.qcid=#{question.qcid}
246 203
         order by convert(u.username using gbk)
247 204
     </select>
248 205
 
@@ -275,4 +232,28 @@
275 232
         FROM t_paper_file
276 233
         WHERE paperid=#{paperid} ORDER BY fileorder asc
277 234
     </select>
235
+    <!--复合题详情-->
236
+    <resultMap id="complexResult" type="com.xhkjedu.sstudy.vo.question.QuestionClassDetailVo">
237
+        <collection property="rates" select="listRate" column="{questionid=questionid,classid=classid}"></collection>
238
+    </resultMap>
239
+    <!--班级作业学生-->
240
+    <select id="listStus" resultType="java.util.Map">
241
+        select ps.studentid,u.username
242
+        from t_paper_student ps left join t_user u on ps.studentid = u.userid
243
+        where paperid=#{question.paperid} and classid=#{question.classid}
244
+    </select>
245
+    <!--班级作业学生作答情况-->
246
+    <select id="listStusAnswer" resultType="com.xhkjedu.sstudy.vo.paperstudent.PaperStudentQuestionVo">
247
+        select questionid,studentid,useranswer,stuscore,qscore
248
+        from t_paper_student_question
249
+        where paperid=#{question.paperid} and classid=#{question.classid} and questionpid=#{question.questionid}
250
+    </select>
251
+    <select id="complexDetail" resultMap="complexResult">
252
+        select qc.qscore,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze,q.complexity
253
+        ,qc.qctype,qc.avgscore,qc.errorrate,qc.paperid,qc.classid,qc.questionid
254
+        ,(select group_concat(p.pointname separator '  ') from t_question_point qp
255
+        left join t_point p on qp.pointid = p.pointid where qp.questionid=q.questionid)pointname
256
+        from t_question_class qc left join t_question q on qc.questionid=q.questionid
257
+        where qc.qcid=#{question.qcid}
258
+    </select>
278 259
 </mapper>

+ 2
- 2
sstudy/src/main/resources/mapper/question/QuestionStudentMapper.xml View File

@@ -84,13 +84,13 @@
84 84
         <result property="stuscore" column="stuscore"></result>
85 85
         <result property="stujson" column="stujson"></result>
86 86
         <collection property="answers" ofType="com.xhkjedu.sstudy.vo.question.StudentAnswerVo" javaType="java.util.List"
87
-                    select="listAnswer" column="{qorder=qorder,paperid=paperid,studentid=studentid}">
87
+                    select="listAnswer" column="{questionid=questionid,paperid=paperid,studentid=studentid}">
88 88
         </collection>
89 89
     </resultMap>
90 90
     <select id="listAnswer" resultType="com.xhkjedu.sstudy.vo.question.StudentAnswerVo">
91 91
         select useranswer,answertype,useranswertxt,stuscore,answertime from t_paper_student_question
92 92
         where paperid!=#{paperid} and studentid=#{studentid} and answered=1 and checked=1 and qscore!=stuscore
93
-        and questionid in(SELECT questionid FROM t_paper_qtype_question WHERE paperid=#{paperid} AND ptqorder=#{qorder})
93
+        and questionpid=#{questionid}
94 94
         order by answertime desc
95 95
     </select>
96 96
     <select id="detail" resultMap="questionResult">

Loading…
Cancel
Save