Browse Source

Merge remote-tracking branch 'origin/ywx' into wn

ywx
王宁 2 months ago
parent
commit
19e1542bed

+ 7
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/papercheck/MsPaperCheckController.java View File

@@ -32,8 +32,10 @@ public class MsPaperCheckController {
32 32
     public ResultVo setCheckType(@RequestBody MsPaperCheck msPaperCheck) {
33 33
         N_Utils.validation(new Object[]{
34 34
                 msPaperCheck.getMpid(), "试卷id", 1
35
+                , msPaperCheck.getMsid(), "考试科目id", 1
35 36
                 , msPaperCheck.getMblockid(), "题块id", 1
36 37
                 , msPaperCheck.getChecktype(), "评卷方式", 1
38
+                , msPaperCheck.getCreateid(), "创建人id", 1
37 39
         });
38 40
         msPaperCheckService.add(msPaperCheck);
39 41
         return new ResultVo(0, "设置成功");
@@ -67,8 +69,10 @@ public class MsPaperCheckController {
67 69
     public ResultVo setArbitrate(@RequestBody MsPaperCheck msPaperCheck) {
68 70
         N_Utils.validation(new Object[]{
69 71
                 msPaperCheck.getMpid(), "试卷id", 1
72
+                , msPaperCheck.getMsid(), "考试科目id", 1
70 73
                 , msPaperCheck.getMblockid(), "题块id", 1
71 74
                 , msPaperCheck.getArbitrateid(), "仲裁教师id", 1
75
+                , msPaperCheck.getCreateid(), "创建人id", 1
72 76
         });
73 77
         msPaperCheckService.setArbitrate(msPaperCheck);
74 78
         return new ResultVo(0, "设置成功");
@@ -85,9 +89,11 @@ public class MsPaperCheckController {
85 89
     public ResultVo setCheckTeacher(@RequestBody MsPaperCheck msPaperCheck) {
86 90
         N_Utils.validation(new Object[]{
87 91
                 msPaperCheck.getMpid(), "试卷id", 1
92
+                , msPaperCheck.getMsid(), "考试科目id", 1
88 93
                 , msPaperCheck.getMblockid(), "题块id", 1
89 94
                 , msPaperCheck.getTeachers(), "阅卷教师", 3
90 95
                 , msPaperCheck.getCorrecttype(), "批阅设置", 1
96
+                , msPaperCheck.getCreateid(), "创建人id", 1
91 97
         });
92 98
         msPaperCheckService.setCheckTeacher(msPaperCheck);
93 99
         return new ResultVo(0, "设置成功");
@@ -124,6 +130,7 @@ public class MsPaperCheckController {
124 130
         Integer dispenseway = msPaperCheck.getDispenseway();
125 131
         N_Utils.validation(new Object[]{
126 132
                 msPaperCheck.getMpid(), "试卷id", 1
133
+                , msPaperCheck.getMsid(), "考试科目id", 1
127 134
                 , msPaperCheck.getMblockid(), "题块id", 1
128 135
                 , dispenseway, "分配方式", 1
129 136
                 , msPaperCheck.getCreateid(), "创建人id", 1

+ 15
- 0
smarking/src/main/java/com/xhkjedu/smarking/controller/papercheck/MsPaperCheckTeacherTaskController.java View File

@@ -131,4 +131,19 @@ public class MsPaperCheckTeacherTaskController {
131 131
         N_Utils.validation(new Object[]{param.getHandleid(), "操作人ID", 1, param.getMpid(), "试卷ID", 1});
132 132
         return new ResultVo(0, "查询成功", msPaperCheckTeacherTaskService.getCorrectBlock(param));
133 133
     }
134
+
135
+    /**
136
+     * @Description 阅卷进度-按试题
137
+     * @Date 2024/11/8 16:19
138
+     * @Author YWX
139
+     * @Param [param]
140
+     * @Return com.xhkjedu.vo.ResultVo
141
+     **/
142
+    @PostMapping("/list_by_question")
143
+    public ResultVo listByQuestion(@RequestBody MsCheckParam param) {
144
+        Integer mpid = param.getMpid();
145
+        N_Utils.validation(new Object[]{mpid, "试卷ID", 1});
146
+        List<Map> list = msPaperCheckTeacherTaskService.listByQuestion(mpid);
147
+        return new ResultVo(0, "查询成功", list);
148
+    }
134 149
 }

+ 5
- 2
smarking/src/main/java/com/xhkjedu/smarking/mapper/exam/MsSubjectMapper.java View File

@@ -36,9 +36,12 @@ public interface MsSubjectMapper extends TkMapper<MsSubject> {
36 36
     //获取考试下所有科目名称
37 37
     List<Map<String,String>> listSubjectNameByExamId(@Param("examid") Integer examid);
38 38
 
39
-    //根据试卷id获取阅卷状态
40
-    Integer getCheckStateByMpId(@Param("mpid") Integer mpid);
39
+    //根据考试科目id获取阅卷状态
40
+    Integer getCheckStateByMsId(@Param("msid") Integer msid);
41 41
 
42 42
     //更改考试科目监考设置状态
43 43
     void updateInvigilateStateByMsId(@Param("msid") Integer msid,@Param("invigilatestate") int invigilatestate);
44
+
45
+    //更改考试科目阅卷设置状态
46
+    void updateCheckSetByMsId(@Param("msid") Integer msid, @Param("checkset") Integer checkset,@Param("correcttype") Integer correcttype);
44 47
 }

+ 4
- 4
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckMapper.java View File

@@ -16,7 +16,7 @@ import java.util.Map;
16 16
  */
17 17
 public interface MsPaperCheckMapper extends TkMapper<MsPaperCheck> {
18 18
     //根据题块id获取阅卷方式id
19
-    Integer getMpcIdByMBlockId(@Param("mblockid") Integer mblockid);
19
+    Integer getMpcIdByMBlockId(@Param("mpid") Integer mpid, @Param("mblockid") Integer mblockid);
20 20
 
21 21
     //阅卷分配-按题块列表(线下)
22 22
     List<Map> listPaperCheck(@Param("mpid") Integer mpid);
@@ -30,9 +30,6 @@ public interface MsPaperCheckMapper extends TkMapper<MsPaperCheck> {
30 30
     //根据题块id获取阅卷信息
31 31
     MsPaperCheck findByMBlockId(@Param("mpid") Integer mpid,@Param("mblockid") Integer mblockid);
32 32
 
33
-    //根据考试科目id获取阅卷信息
34
-    List<MsPaperCheck> listByMsId(@Param("msid") Integer msid);
35
-
36 33
     //获取学生作答及批阅信息
37 34
     List<MsPaperCheckVo> listStudentByMBlockId(@Param("mblockid") Integer mblockid,@Param("numtype") Integer numtype);
38 35
     List<MsPaperCheckVo> listStudentByMpsqId(@Param("mblockid") Integer mblockid,@Param("numtype") Integer numtype);
@@ -51,4 +48,7 @@ public interface MsPaperCheckMapper extends TkMapper<MsPaperCheck> {
51 48
 
52 49
     //根据mpid和mblockids删除阅卷方式
53 50
     void deleteByMpIdAndBlockIds(@Param("mpid") Integer mpid,@Param("mblockids") List<Integer> mblockids);
51
+
52
+    //获取阅卷设置状态
53
+    Integer getCheckSetById(@Param("mpcid") Integer mpcid);
54 54
 }

+ 5
- 1
smarking/src/main/java/com/xhkjedu/smarking/mapper/papercheck/MsPaperCheckTeacherTaskMapper.java View File

@@ -30,7 +30,8 @@ public interface MsPaperCheckTeacherTaskMapper extends TkMapper<MsPaperCheckTeac
30 30
     List<Map> listByBlock(@Param("mpid") Integer mpid);
31 31
 
32 32
     //阅卷进度-按题块-查看详情
33
-    List<Map> detailByBlock(@Param("mpid") Integer mpid, @Param("mblockid") Integer mblockid);
33
+    List<Map> detailByBlock(@Param("mpid") Integer mpid, @Param("mblockid") Integer mblockid
34
+            , @Param("dispenseway") Integer dispenseway,@Param("checktype") Integer checktype);
34 35
 
35 36
     //阅卷进度-按教师
36 37
     List<Map> listByTeacher(@Param("mpid") Integer mpid);
@@ -54,4 +55,7 @@ public interface MsPaperCheckTeacherTaskMapper extends TkMapper<MsPaperCheckTeac
54 55
 
55 56
     //删除教师阅卷任务
56 57
     void deleteByMpsbids(@Param("mpsbids") String mpsbids);
58
+
59
+    //阅卷进度-按试题
60
+    List<Map> listByQuestion(@Param("mpid") Integer mpid,@Param("correcttype") Integer correcttype);
57 61
 }

+ 2
- 0
smarking/src/main/java/com/xhkjedu/smarking/model/paper/MsPaper.java View File

@@ -35,6 +35,8 @@ public class MsPaper extends BaseBean {
35 35
     private Double pscore;
36 36
     //是否设置正确答案0未设置1已设置
37 37
     private Integer answered;
38
+    //批阅设置:1按班设置2按题设置3按题块设置
39
+    private Integer correcttype;
38 40
     //是否有附件0没有1有附件
39 41
     private Integer hasfile;
40 42
     //听力允许播放次数0不限制

+ 6
- 0
smarking/src/main/java/com/xhkjedu/smarking/service/exam/MsSubjectService.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.smarking.service.exam;
2 2
 
3
+import com.xhkjedu.exception.ServiceException;
3 4
 import com.xhkjedu.smarking.mapper.exam.MsSubjectMapper;
4 5
 import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckMapper;
5 6
 import com.xhkjedu.smarking.model.exam.MsSubject;
@@ -72,12 +73,17 @@ public class MsSubjectService {
72 73
      **/
73 74
     @Transactional(rollbackFor = Exception.class)
74 75
     public void updateCheckState(Integer msid, Integer handleid, int checkstate) {
76
+        MsSubject subject = msSubjectMapper.selectByPrimaryKey(msid);
77
+        if (subject == null) {
78
+            throw new ServiceException("考试科目不存在");
79
+        }
75 80
 
76 81
         MsSubject msSubject = new MsSubject();
77 82
         msSubject.setMsid(msid);
78 83
         msSubject.setHandleid(handleid);
79 84
         msSubject.setCheckstate(checkstate);
80 85
         msSubject.setHandletime(N_Utils.getSecondTimestamp());
86
+        msSubject.setCheckset(2);
81 87
         msSubjectMapper.updateByPrimaryKeySelective(msSubject);
82 88
 
83 89
         msPaperCheckMapper.updateCheckStateByMsId(msid, checkstate);//更新题块阅卷状态

+ 3
- 2
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckService.java View File

@@ -41,20 +41,21 @@ public class MsPaperCheckService {
41 41
      * @Return void
42 42
      **/
43 43
     public void add(MsPaperCheck msPaperCheck) {
44
-        Integer checkstate = msSubjectMapper.getCheckStateByMpId(msPaperCheck.getMpid());//根据试卷id获取阅卷状态
44
+        Integer checkstate = msSubjectMapper.getCheckStateByMsId(msPaperCheck.getMsid());//根据考试科目id获取阅卷状态
45 45
         if (checkstate.equals(0)) throw new ServiceException("开始阅卷后不支持修改");
46 46
         saveOrUpdate(msPaperCheck);
47 47
     }
48 48
 
49 49
     //添加或更新阅卷方式
50 50
     private void saveOrUpdate(MsPaperCheck msPaperCheck) {
51
-        Integer mpcid = msPaperCheckMapper.getMpcIdByMBlockId(msPaperCheck.getMblockid());
51
+        Integer mpcid = msPaperCheckMapper.getMpcIdByMBlockId(msPaperCheck.getMpid(), msPaperCheck.getMblockid());
52 52
         if (N_Utils.isTrueInteger(mpcid)) {
53 53
             msPaperCheck.setMpcid(mpcid);
54 54
             msPaperCheckMapper.updateByPrimaryKeySelective(msPaperCheck);
55 55
         } else {
56 56
             msPaperCheck.setCreatetime(N_Utils.getSecondTimestamp());
57 57
             msPaperCheckMapper.insertSelective(msPaperCheck);
58
+            msSubjectMapper.updateCheckSetByMsId(msPaperCheck.getMsid(), 1, msPaperCheck.getCorrecttype());//更改考试科目阅卷设置状态
58 59
         }
59 60
     }
60 61
 

+ 42
- 1
smarking/src/main/java/com/xhkjedu/smarking/service/papercheck/MsPaperCheckTeacherTaskService.java View File

@@ -1,8 +1,11 @@
1 1
 package com.xhkjedu.smarking.service.papercheck;
2 2
 
3 3
 import com.xhkjedu.exception.ServiceException;
4
+import com.xhkjedu.smarking.mapper.paper.MsPaperMapper;
5
+import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckMapper;
4 6
 import com.xhkjedu.smarking.mapper.papercheck.MsPaperCheckTeacherTaskMapper;
5 7
 import com.xhkjedu.smarking.mapper.system.UserMapper;
8
+import com.xhkjedu.smarking.model.paper.MsPaper;
6 9
 import com.xhkjedu.smarking.model.papercheck.MsPaperCheck;
7 10
 import com.xhkjedu.smarking.vo.papercheck.MsCheckParam;
8 11
 import com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo;
@@ -25,6 +28,10 @@ public class MsPaperCheckTeacherTaskService {
25 28
     private MsPaperCheckTeacherTaskMapper msPaperCheckTeacherTaskMapper;
26 29
     @Resource
27 30
     private UserMapper userMapper;
31
+    @Resource
32
+    private MsPaperCheckMapper msPaperCheckMapper;
33
+    @Resource
34
+    private MsPaperMapper msPaperMapper;
28 35
 
29 36
     /**
30 37
      * @Description 阅卷进度-按题块
@@ -45,7 +52,22 @@ public class MsPaperCheckTeacherTaskService {
45 52
      * @Return java.util.List<java.util.Map>
46 53
      **/
47 54
     public List<Map> detailByBlock(Integer mpid, Integer mblockid) {
48
-        return msPaperCheckTeacherTaskMapper.detailByBlock(mpid, mblockid);
55
+        MsPaperCheck check = msPaperCheckMapper.findByMBlockId(mpid, mblockid);
56
+        if (check == null) {
57
+            throw new ServiceException("该题块不存在");
58
+        }
59
+        Integer dispenseway = check.getDispenseway();
60
+        List<Map> list = msPaperCheckTeacherTaskMapper.detailByBlock(mpid, mblockid, dispenseway, check.getChecktype());
61
+        if (dispenseway.equals(2)) {
62
+            int totalNum = list.stream().mapToInt(m -> N_Utils.obj2Int(m.get("totalNum"))).sum();
63
+            int totalCheckedNum = list.stream().mapToInt(m -> N_Utils.obj2Int(m.get("checkedNum"))).sum();
64
+            int uncheckedNum = totalNum - totalCheckedNum;
65
+            for (Map m : list) {
66
+                m.put("totalNum", totalNum);
67
+                m.put("uncheckedNum", uncheckedNum);
68
+            }
69
+        }
70
+        return list;
49 71
     }
50 72
 
51 73
     /**
@@ -133,4 +155,23 @@ public class MsPaperCheckTeacherTaskService {
133 155
         String msg = "获取成功";
134 156
         return new ResultVo(0, msg, map);
135 157
     }
158
+
159
+    /**
160
+     * @Description 阅卷进度-按试题
161
+     * @Date 2024/11/8 16:18
162
+     * @Author YWX
163
+     * @Param [mpid]
164
+     * @Return java.util.List<java.util.Map>
165
+     **/
166
+    public List<Map> listByQuestion(Integer mpid) {
167
+        MsPaper paper = msPaperMapper.selectByPrimaryKey(mpid);
168
+        if (paper == null) {
169
+            throw new ServiceException("该试卷不存在");
170
+        }
171
+        Integer correcttype = paper.getCorrecttype();
172
+        if (!N_Utils.isTrueInteger(correcttype)) {
173
+            throw new ServiceException("该试卷未设置批阅方式");
174
+        }
175
+        return msPaperCheckTeacherTaskMapper.listByQuestion(mpid, correcttype);
176
+    }
136 177
 }

+ 10
- 4
smarking/src/main/resources/mapper/exam/MsSubjectMapper.xml View File

@@ -48,9 +48,9 @@
48 48
     <select id="listSubjectNameByExamId" resultType="java.util.Map">
49 49
         select subjectid,subjectname from ms_subject where examid=#{examid}
50 50
     </select>
51
-    <!--根据试卷id获取阅卷状态-->
52
-    <select id="getCheckStateByMpId" resultType="java.lang.Integer">
53
-        select s.checkstate from ms_paper p inner join ms_subject s on p.msid=s.msid where p.mpid=#{mpid}
51
+    <!--根据考试科目id获取阅卷状态-->
52
+    <select id="getCheckStateByMsId" resultType="java.lang.Integer">
53
+        select s.checkstate from ms_subject s where s.msid=#{msid}
54 54
     </select>
55 55
 
56 56
     <!--更改科目试卷模板设置状态-->
@@ -65,5 +65,11 @@
65 65
     <update id="updateInvigilateStateByMsId">
66 66
         update ms_subject set invigilatestate=#{invigilatestate} where msid=#{msid}
67 67
     </update>
68
-    
68
+    <!--更改考试科目阅卷设置状态-->
69
+    <update id="updateCheckSetByMsId">
70
+        update ms_subject s inner join ms_paper p on s.msid=p.msid
71
+        set s.checkset=#{checkset},p.correcttype=#{correcttype}
72
+        where s.msid=#{msid}
73
+    </update>
74
+
69 75
 </mapper>

+ 15
- 9
smarking/src/main/resources/mapper/papercheck/MsPaperCheckMapper.xml View File

@@ -14,11 +14,12 @@
14 14
     </delete>
15 15
     <!--根据题块id获取阅卷方式id-->
16 16
     <select id="getMpcIdByMBlockId" resultType="java.lang.Integer">
17
-        select mpcid from ms_paper_check where mblockid = #{mblockid}
17
+        select mpcid from ms_paper_check where mpid = #{mpid} and mblockid = #{mblockid}
18 18
     </select>
19 19
 
20 20
     <resultMap id="paperCheckResultMap" type="java.util.Map">
21 21
         <result property="mpid" column="mpid"/>
22
+        <result property="msid" column="msid"/>
22 23
         <result property="mblockid" column="mblockid"/>
23 24
         <result property="blockname" column="blockname"/>
24 25
         <result property="blockorder" column="blockorder"/>
@@ -38,10 +39,11 @@
38 39
     </select>
39 40
     <!--阅卷分配-按题块列表(线下)-->
40 41
     <select id="listPaperCheck" resultMap="paperCheckResultMap">
41
-        select pb.mpid,pb.mblockid,pb.blockname,pb.blockorder,pb.bqnum,pb.bqscore
42
+        select pb.mpid,p.msid,pb.mblockid,pb.blockname,pb.blockorder,pb.bqnum,pb.bqscore
42 43
         ,pc.mpcid,pc.checktype,pc.dispenseway
43 44
         ,if(pc.checktype=2,(select u.username from t_user u where u.userid=pc.arbitrateid),'') as arbitratename
44 45
         from ms_paper_check pc right join ms_paper_block pb on pc.mblockid = pb.mblockid
46
+        inner join ms_paper p on pb.mpid = p.mpid
45 47
         where pb.mpid = #{mpid} and pb.blocktype = 2
46 48
         order by pb.blockorder
47 49
     </select>
@@ -66,11 +68,6 @@
66 68
         select mpcid,mpid,mblockid,checktype,arbitrateid,hidefirstscore,scoreway,finalscore,roundvalue,dispenseway
67 69
         from ms_paper_check where mpid = #{mpid} and mblockid = #{mblockid}
68 70
     </select>
69
-    <!--根据考试科目id获取阅卷信息-->
70
-    <select id="listByMsId" resultType="com.xhkjedu.smarking.model.papercheck.MsPaperCheck">
71
-        select mpcid,mpid,mblockid,checktype,arbitrateid,hidefirstscore,scoreway,finalscore,roundvalue,dispenseway
72
-        from ms_paper_check where msid = #{msid}
73
-    </select>
74 71
     <!--获取学生作答及批阅信息(按题块)-->
75 72
     <select id="listStudentByMBlockId" resultType="com.xhkjedu.smarking.vo.papercheck.MsPaperCheckVo">
76 73
         select psb.mpsbid,psb.mblockid,psb.checked,psb.firstcid,psb.firstcime,psb.secondcid,psb.secondctime
@@ -99,11 +96,12 @@
99 96
         <result property="mblockid" column="mblockid"/>
100 97
         <result property="classname" column="classname"/>
101 98
         <result property="mpid" column="mpid"/>
99
+        <result property="msid" column="msid"/>
102 100
         <result property="mpcid" column="mpcid"/>
103 101
         <collection property="teachers" select="listCheckTeacher" column="mblockid"/>
104 102
     </resultMap>
105 103
     <select id="listSubjectClass" resultMap="classResultMap">
106
-        select c.gradeid,mc.classid as mblockid,mc.classname,p.mpid,pc.mpcid
104
+        select c.gradeid,mc.classid as mblockid,mc.classname,p.mpid,p.msid,pc.mpcid
107 105
         from ms_paper p inner join ms_class mc on p.examid=mc.examid and mc.subjectid=p.subjectid
108 106
         inner join t_class c on mc.classid=c.classid
109 107
         left join ms_paper_check pc on p.mpid=pc.mpid and pc.mblockid=mc.classid
@@ -116,6 +114,7 @@
116 114
         <result property="qn" column="qn"/>
117 115
         <result property="mblockid" column="mblockid"/>
118 116
         <result property="mpid" column="mpid"/>
117
+        <result property="msid" column="msid"/>
119 118
         <result property="mpcid" column="mpcid"/>
120 119
         <result property="checktype" column="checktype"/>
121 120
         <result property="dispenseway" column="dispenseway"/>
@@ -123,9 +122,10 @@
123 122
         <collection property="teachers" select="listCheckTeacher" column="mblockid"/>
124 123
     </resultMap>
125 124
     <select id="listQuestion" resultMap="questionResultMap">
126
-        select q.qorder,q.qn,q.mptqid as mblockid,q.mpid,pc.mpcid,pc.checktype,pc.dispenseway
125
+        select q.qorder,q.qn,q.mptqid as mblockid,q.mpid,p.msid,pc.mpcid,pc.checktype,pc.dispenseway
127 126
         ,if(pc.checktype=2,(select u.username from t_user u where u.userid=pc.arbitrateid),'') as arbitratename
128 127
         from ms_paper_qtype_question q left join ms_paper_check pc on q.mpid=pc.mpid
128
+        inner join ms_paper p on q.mpid=p.mpid
129 129
         where q.mpid=#{mpid} and q.ctype in(3,13,14,15)
130 130
     </select>
131 131
     <!--获取需要批阅的数量-->
@@ -141,4 +141,10 @@
141 141
             where psb.mblockid=#{mblockid}
142 142
         </if>
143 143
     </select>
144
+    <!--获取阅卷设置状态-->
145
+    <select id="getCheckSetById" resultType="java.lang.Integer">
146
+        select if((checktype=1 or (checktype=2 and arbitrateid is not null)) and dispenseway in(1,2,3) and count(pct.mpctid)>0,2,1)
147
+        from ms_paper_check pc left join ms_paper_check_teacher pct on pc.mblockid=pct.mblockid and pc.mpid=pct.mpid
148
+        where pc.mpcid=#{mpcid}
149
+    </select>
144 150
 </mapper>

+ 51
- 7
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml View File

@@ -71,12 +71,32 @@
71 71
     </select>
72 72
     <!--阅卷进度-按题块-查看详情-->
73 73
     <select id="detailByBlock" resultType="java.util.Map">
74
-        select pctt.teacherid,u.username as teachername
75
-        ,count(pctt.mpcttid) as total_num,count(if(pctt.checkstate=3,1,null)) as checked_num
76
-        ,count(if(pctt.checkstate!=3,1,null))as uncheck_num
77
-        from ms_paper_check_teacher_task pctt left join t_user u on u.userid = pctt.teacherid
78
-        where pctt.mpid=#{mpid} and pctt.mblockid=#{mblockid}
79
-        group by pctt.teacherid
74
+        <if test="dispenseway!=null and dispenseway!=2">
75
+            select pctt.teacherid,u.username as teachername
76
+            ,count(pctt.mpcttid) as total_num,count(if(pctt.checkstate=3,1,null)) as checked_num
77
+            ,count(if(pctt.checkstate!=3,1,null))as uncheck_num
78
+            from ms_paper_check_teacher_task pctt left join t_user u on u.userid = pctt.teacherid
79
+            where pctt.mpid=#{mpid} and pctt.mblockid=#{mblockid}
80
+            group by pctt.teacherid
81
+        </if>
82
+        <if test="dispenseway!=null and dispenseway==2">
83
+            select t.teacherid,u.username as teachername
84
+            ,sum(t.total_num) as total_num,sum(t.checked_num) as checked_num,sum(t.uncheck_num) as uncheck_num
85
+            from(select psb.firstcid as teacherid,count(*) as total_num,count(if(psb.firstcime is not null,1,null)) as checked_num
86
+            ,count(if(psb.firstcime is null,1,null)) as uncheck_num
87
+            from ms_paper_student_block psb
88
+            where psb.mpid=#{mpid} and psb.mblockid=#{mblockid}
89
+            group by psb.firstcid
90
+            <if test="checktype!=null and checktype==2">
91
+                union
92
+                select psb.secondcid as teacherid,count(*) as total_num,count(if(psb.secondctime is not null,1,null)) as checked_num
93
+                ,count(if(psb.secondctime is null,1,null)) as uncheck_num
94
+                from ms_paper_student_block psb
95
+                where psb.mpid=#{mpid} and psb.mblockid=#{mblockid}
96
+                group by psb.secondcid
97
+            </if>)t left join t_user u on t.teacherid=u.userid
98
+            group by t.teacherid
99
+        </if>
80 100
     </select>
81 101
     <!--阅卷进度-按教师-->
82 102
     <resultMap id="teacherResultMap" type="java.util.Map">
@@ -134,7 +154,7 @@
134 154
     <select id="listPendingBlock" resultType="java.util.Map">
135 155
         select pb.blockname,pb.blockorder,pb.bqnum
136 156
         ,pc.mblockid,pc.checktype,pc.dispenseway,pc.numtype
137
-        ,count(distinct psb.mpsbid)*pc.checktype as total_num
157
+        ,count(distinct psb.mpsbid) as total_num
138 158
         ,count(if(psb.firstcime>0 or psb.secondctime>0,psb.mpsbid,null)) as total_checked_num
139 159
         ,count(if(psb.firstcime=0 or (pc.checktype=2 and psb.secondctime=0),psb.mpsbid,null)) as total_uncheck_num
140 160
         ,count(if((psb.firstcime>0 and psb.firstcid=#{param.handleid}) or (psb.secondctime>0 and psb.secondcid=#{param.handleid}),psb.mpsbid,null)) as my_checked_num
@@ -195,4 +215,28 @@
195 215
         order by field(psb.checked,2,1,3),pctt.taskorder
196 216
         limit 1
197 217
     </select>
218
+    <!--阅卷进度-按试题-->
219
+    <resultMap id="questionResultMap" type="java.util.Map">
220
+        <result property="qorder" column="qorder"/>
221
+        <result property="qn" column="qn"/>
222
+        <result property="qscore" column="qscore"/>
223
+        <result property="mblockid" column="mblockid"/>
224
+        <result property="mpid" column="mpid"/>
225
+        <result property="checktype" column="checktype"/>
226
+        <result property="totalNum" column="total_num"/>
227
+        <result property="checkedNum" column="checked_num"/>
228
+        <result property="uncheckedNum" column="uncheck_num"/>
229
+        <collection property="teachers" select="listCheckTeacher" column="mblockid"/>
230
+    </resultMap>
231
+    <select id="listByQuestion" resultMap="questionResultMap">
232
+        select q.qorder,q.qn,q.qscore,q.mptqid as mblockid,q.mpid,pc.checktype
233
+        ,count(distinct psq.mpsqid) as total_num
234
+        ,count(if(psq.firstcime is not null or psq.secondctime is not null,psq.mpsqid,null)) as checked_num
235
+        ,count(if(psq.firstcime is null or (pc.checktype=2 and psq.secondctime is null),psq.mpsqid,null)) as uncheck_num
236
+        from ms_paper_qtype_question q left join ms_paper_check pc on q.mpid=pc.mpid
237
+        left join ms_paper_student_question psq on q.mptqid=psq.mptqid and psq.answered=1
238
+        where q.mpid=#{mpid} and q.ctype in(3,13,14,15)
239
+        group by q.mptqid
240
+        order by q.qorder,q.qn
241
+    </select>
198 242
 </mapper>

Loading…
Cancel
Save