Browse Source

完善试卷信息

ywx
王宁 1 month ago
parent
commit
d93b71ec8f

+ 1
- 1
sexam/src/main/resources/mapper/paper/EPaperCorrectTeacherMapper.xml View File

@@ -21,7 +21,7 @@
21 21
         left join e_paper_student_question psq on psq.eptqid=pq.eptqid
22 22
         where pq.teacherid=#{teacherid} group by p.epid)a left join e_subject es on a.esid = es.esid
23 23
         left join e_base eb on es.examid = eb.examid
24
-        where a.tjnum!=a.pynum and eb.deleted=1
24
+        where a.tjnum!=a.pynum and eb.deleted=1 order by es.sdate desc,es.endtime desc
25 25
     </select>
26 26
     <!--已阅卷列表-->
27 27
     <select id="listMarked" resultType="java.util.Map">

+ 5
- 5
smarking/src/main/java/com/xhkjedu/smarking/controller/paper/MsPaperQtypeController.java View File

@@ -131,16 +131,16 @@ public class MsPaperQtypeController {
131 131
     }
132 132
 
133 133
     /*
134
-     * @Description 试卷-主观题
134
+     * @Description 试卷-客观题/主观题
135 135
      * @Date 2024/10/21 13:53:38
136 136
      * @Author WN
137 137
      * @Param [subject]
138 138
      * @Return com.xhkjedu.vo.ResultVo
139 139
      **/
140
-    @PostMapping("/paper_sub")
141
-    public ResultVo listSubjectiveQuesitons(@RequestBody MsSubject subject){
142
-        N_Utils.validation(new Object[]{subject.getMsid(),"考试科目id",1});
143
-        List<Map<String,Object>> map =msPaperQtypeService.listPaperSubjectiveQuestions(subject.getMsid());
140
+    @PostMapping("/paper_que")
141
+    public ResultVo listObjOrSubQuesitons(@RequestBody MsPaperParams params){
142
+        N_Utils.validation(new Object[]{params.getMpid(),"试卷id",1});
143
+        List<Map<String,Object>> map =msPaperQtypeService.listPaperSubjectiveQuestions(params.getMpid(),params.getQtype());
144 144
         return new ResultVo(0,"获取成功" ,map);
145 145
     }
146 146
 

+ 0
- 2
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperMapper.java View File

@@ -41,8 +41,6 @@ public interface MsPaperMapper extends TkMapper<MsPaper> {
41 41
     //根据试卷id获取考试状态
42 42
     Integer getExamStateByMpid(@Param("mpid") Integer mpid);
43 43
 
44
-    //根据科目id获取试卷基础信息
45
-    MsPaper getPaperBaseByMsid(@Param("msid") Integer msid);
46 44
 
47 45
     //获取试卷ID及考试模式
48 46
     PExamSubjectVo getPaperAndMxammodeByMsid(@Param("msid") Integer msid);

+ 2
- 2
smarking/src/main/java/com/xhkjedu/smarking/mapper/paper/MsPaperQtypeMapper.java View File

@@ -26,9 +26,9 @@ public interface MsPaperQtypeMapper extends TkMapper<MsPaperQtype> {
26 26
     List<MsPaperQtypeVo> listPaperQtypeQuesitonsForFj(@Param("mpid") Integer mpid);
27 27
 
28 28
     //试卷主观题-附件
29
-    List<Map<String,Object>> listSubjectiveQuestionsFj(@Param("mpid") Integer mpid,@Param("ctypes")int[] ctypes);
29
+    List<Map<String,Object>> listSubjectiveQuestionsFj(@Param("mpid") Integer mpid,@Param("qtype")Integer qtype);
30 30
     //试卷主观题-题库
31
-    List<Map<String,Object>> listSubjectiveQuestionsTk(@Param("mpid") Integer mpid,@Param("ctypes")int[] ctypes);
31
+    List<Map<String,Object>> listSubjectiveQuestionsTk(@Param("mpid") Integer mpid,@Param("qtype")Integer qtype);
32 32
     //修改题型分,修改试卷分
33 33
     int updateQtypeScore(@Param("mptid") Integer mptid,@Param("mpid") Integer mpid);
34 34
     //修改题型分和试题数量,修改试卷分和试题数量

+ 16
- 15
smarking/src/main/java/com/xhkjedu/smarking/service/paper/MsPaperQtypeService.java View File

@@ -418,7 +418,7 @@ public class MsPaperQtypeService {
418 418
             msPaperAnalyzeMapper.insertUseGeneratedKeys(epa);
419 419
         } else {
420 420
             epa.setMpaid(existEpa.getMpaid());
421
-            msPaperAnalyzeMapper.updateByPrimaryKeySelective(epa);
421
+            msPaperAnalyzeMapper.updateByPrimaryKey(epa);
422 422
         }
423 423
     }
424 424
 
@@ -717,8 +717,10 @@ public class MsPaperQtypeService {
717 717
             }
718 718
 
719 719
             List<Map<String, Object>> qpoints = q.getPoints();
720
-            // 存放知识点
721
-            setPaperQuestionPointScore(pointqlist, quesplist, qpoints, q, null, null);
720
+            if(qpoints != null) {
721
+                // 存放知识点
722
+                setPaperQuestionPointScore(pointqlist, quesplist, qpoints, q, null, null);
723
+            }
722 724
         }
723 725
 
724 726
         double znumrate = N_Utils.getIntegerDivideAndMulitiply(znum, paper.getPnum());
@@ -869,7 +871,7 @@ public class MsPaperQtypeService {
869 871
             msPaperAnalyzeMapper.insertUseGeneratedKeys(epa);
870 872
         } else {
871 873
             epa.setMpaid(existEpa.getMpaid());
872
-            msPaperAnalyzeMapper.updateByPrimaryKeySelective(epa);
874
+            msPaperAnalyzeMapper.updateByPrimaryKey(epa);
873 875
         }
874 876
     }
875 877
 
@@ -898,15 +900,11 @@ public class MsPaperQtypeService {
898 900
         for (MsPaperQtypeQuestion tq : questions) {
899 901
             if (N_Utils.isTrueInteger(tq.getMptqid()) && N_Utils.isNotEmpty(tq.getQanswer())) {
900 902
                 MsPaperQtypeQuestion yq = yqlist.stream().filter(y -> y.getMptqid().equals(tq.getMptqid())).findFirst().orElse(null);
901
-
902
-                assert yq != null;
903
-                if (N_Utils.isObjectiveQuestion(yq.getCtype())) {
903
+                if(yq!=null && yq.getQtype() == 1){
904 904
                     if (!tq.getQanswer().equalsIgnoreCase(yq.getQanswer()) || !tq.getLoseoption().equals(yq.getLoseoption()) || !tq.getScoreset().equals(yq.getScoreset())) {
905 905
                         // 说明新设置的答案和原设置的答案不一致,则为变动的
906 906
                         tq.setCtype(yq.getCtype());
907 907
                         tq.setQscore(yq.getQscore());
908
-                        tq.setLoseoption(yq.getLoseoption());
909
-                        tq.setScoreset(yq.getScoreset());
910 908
                         changelist.add(tq);
911 909
                     }
912 910
                 }
@@ -1115,7 +1113,11 @@ public class MsPaperQtypeService {
1115 1113
             for (MsPaperQtypeVo qtype : qtypelist) {
1116 1114
                 List<MsPaperQtypeQuestionVo> questions = qtype.getQuestions();
1117 1115
                 for (MsPaperQtypeQuestionVo question : questions) {
1118
-                    question.setQanswer(question.getAnswer());// 把试卷中设置的答案返回
1116
+                    if(N_Utils.isNotEmpty(question.getAnswer())){
1117
+                        //如果试卷已有答案,把试卷中设置的答案返回
1118
+                        question.setQanswer(question.getAnswer());
1119
+                    }
1120
+
1119 1121
                 }
1120 1122
             }
1121 1123
             paper.put("qtypes", qtypelist);
@@ -1182,14 +1184,13 @@ public class MsPaperQtypeService {
1182 1184
      * @Param [mpid]
1183 1185
      * @Return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
1184 1186
      **/
1185
-    public List<Map<String, Object>> listPaperSubjectiveQuestions(Integer mpid) {
1186
-        MsPaper paper = msPaperMapper.getPaperBaseByMsid(mpid);
1187
-        int[] subjectivelist = N_Utils.subjectiveList;
1187
+    public List<Map<String, Object>> listPaperSubjectiveQuestions(Integer mpid,Integer qtype) {
1188
+        MsPaper paper = msPaperMapper.selectByPrimaryKey(mpid);
1188 1189
         List<Map<String, Object>> rtnList;
1189 1190
         if (paper.getPtype() == 1) {
1190
-            rtnList = msPaperQtypeMapper.listSubjectiveQuestionsTk(mpid, subjectivelist);
1191
+            rtnList = msPaperQtypeMapper.listSubjectiveQuestionsTk(mpid, qtype);
1191 1192
         } else {
1192
-            rtnList = msPaperQtypeMapper.listSubjectiveQuestionsFj(mpid, subjectivelist);
1193
+            rtnList = msPaperQtypeMapper.listSubjectiveQuestionsFj(mpid, qtype);
1193 1194
         }
1194 1195
 
1195 1196
         return rtnList;

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/vo/paper/MsPaperParams.java View File

@@ -30,5 +30,7 @@ public class MsPaperParams {
30 30
     private Integer movetype;//移动类型1上移2下移
31 31
     private Integer movevalue;//移动值
32 32
 
33
+    private Integer qtype;//试题类型1客观题2主观题
34
+
33 35
     private List<MsPaperQtypeQuestion> questions;//试题列表
34 36
 }

+ 0
- 4
smarking/src/main/resources/mapper/paper/MsPaperMapper.xml View File

@@ -77,10 +77,6 @@
77 77
         select eb.examstate from ms_paper ep left join ms_exam eb on ep.examid = eb.examid where ep.mpid=#{mpid}
78 78
     </select>
79 79
 
80
-    <!--获取试卷基础信息-->
81
-    <select id="getPaperBaseByMsid" resultType="com.xhkjedu.smarking.model.paper.MsPaper">
82
-        select p.* from ms_paper p left join ms_subject s on s.msid=p.msid where s.msid=#{msid}
83
-    </select>
84 80
     <!--获取试卷ID及考试模式-->
85 81
     <select id="getPaperAndMxammodeByMsid" resultType="com.xhkjedu.smarking.vo.paper.PExamSubjectVo">
86 82
         select p.mpid,e.exammode from ms_paper p left join ms_exam e on p.examid=e.examidwhere p.msid=#{msid}

+ 13
- 13
smarking/src/main/resources/mapper/paper/MsPaperQtypeMapper.xml View File

@@ -139,31 +139,31 @@
139 139
             <result column="mptqid" property="mptqid" />
140 140
             <result column="qscore" property="qscore" />
141 141
             <result column="qorder" property="qorder" />
142
-            <result column="qtypeid" property="qtypeid" />
143
-            <result column="qtypename" property="qtypename" />
144 142
             <result column="ctype" property="ctype" />
145 143
             <result column="qn" property="qn" />
144
+            <result column="qanswer" property="qanswer" />
145
+            <result column="optionnum" property="optionnum" />
146
+            <result column="loseoption" property="loseoption" />
147
+            <result column="scoreset" property="scoreset" />
148
+            <result column="sorder" property="sorder" />
146 149
         </collection>
147 150
     </resultMap>
148 151
     <select id="listSubjectiveQuestionsFj" resultMap="subjectiveQuestions">
149 152
         select t.mptid,t.mptqn,t.mptname,t.mptnum,t.mptorder,t.mptscore,
150
-        q.mptqid,q.qtypeid,q.qtypename,q.ctype,q.qscore,q.qn,q.qorder
153
+        q.mptqid,q.qtypeid,q.qtypename,q.ctype,q.qscore,q.qn,q.qorder,q.qanswer,q.optionnum,q.loseoption,q.scoreset
151 154
         from ms_paper_qtype_question q left join ms_paper_qtype t on t.mptid=q.mptid
152
-        where t.mpid=#{mpid} and q.ctype in
153
-        <foreach collection="ctypes" item="c" open="(" separator="," close=")">
154
-            #{c}
155
-        </foreach>
155
+        where t.mpid=#{mpid}
156
+        <if test="qtype!=null and qtype!=0"> and q.qtype=#{qtype}</if>
156 157
         order by t.mptorder,q.qorder
157 158
     </select>
158 159
 
159 160
     <select id="listSubjectiveQuestionsTk" resultMap="subjectiveQuestions">
160
-        select t.mptid,t.mptqn,t.mptname,t.mptnum,t.mptorder,t.mptscore,
161
-        q.mptqid,q.qtypeid,q.qtypename,q.ctype,q.qscore,q.qn,q.qorder
161
+        select t.mptid,t.mptqn,t.mptname,t.mptnum,t.mptorder,t.mptscore,q.mptqid,
162
+        q.ctype,q.qscore,q.qn,q.qorder,q.qanswer,q.optionnum,q.loseoption,q.scoreset,q2.sorder
162 163
         from ms_paper_qtype_question q left join ms_paper_qtype t on t.mptid=q.mptid
163
-        where t.mpid=#{mpid} and q.ctype in
164
-        <foreach collection="ctypes" item="c" open="(" separator="," close=")">
165
-            #{c}
166
-        </foreach>
164
+        left join t_question q2 on q.questionid=q2.questionid
165
+        where t.mpid=#{mpid}
166
+        <if test="qtype!=null and qtype!=0"> and q.qtype=#{qtype}</if>
167 167
         order by t.mptorder,q.qorder
168 168
     </select>
169 169
 

Loading…
Cancel
Save