Browse Source

批阅完善

ywx
雍文秀 1 month ago
parent
commit
4ec0bf66f4

+ 49
- 35
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml View File

147
     <select id="listByTeacher" resultMap="teacherResultMap">
147
     <select id="listByTeacher" resultMap="teacherResultMap">
148
         <if test="correcttype==1">
148
         <if test="correcttype==1">
149
             select pct.teacherid,u.username as teachername
149
             select pct.teacherid,u.username as teachername
150
-            ,if(pc.dispenseway=2,count(psb.mpsqid)*pc.checktype
151
-            ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsqid,null))
152
-            ) as totalNum
153
-            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime>0) or (psb.secondcid=pct.teacherid and psb.secondctime>0),psb.mpsqid,null)) as checkedNum
154
-            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime=0) or (psb.secondcid=pct.teacherid and psb.secondctime=0),psb.mpsqid,null)) as uncheckedNum
150
+            ,count(distinct psb.mpsqid) as totalNum
151
+            ,count(distinct if(psb.firstcid=pct.teacherid and psb.checked=3,psb.mpsqid,null)) as checkedNum
152
+            ,count(distinct if((psb.firstcid=pct.teacherid and psb.checked=2) or psb.checked=1,psb.mpsqid,null)) as uncheckedNum
155
             ,psb.mptqid as mblockid,psb.qorder,psb.qn
153
             ,psb.mptqid as mblockid,psb.qorder,psb.qn
156
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
154
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
157
             left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
155
             left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
158
             left join ms_paper_student_question psb on pct.mpid = psb.mpid
156
             left join ms_paper_student_question psb on pct.mpid = psb.mpid
159
             inner join ms_class c on c.examid=psb.examid and c.subjectid=psb.subjectid and c.classid=pct.mblockid
157
             inner join ms_class c on c.examid=psb.examid and c.subjectid=psb.subjectid and c.classid=pct.mblockid
160
-            where pct.mpid=#{mpid} and psb.ctype in (3, 13, 14, 15)
158
+            where pct.mpid=#{mpid} and psb.ctype in (3, 13, 14, 15) and psb.answered=1
161
             group by pct.teacherid,psb.mptqid
159
             group by pct.teacherid,psb.mptqid
162
             order by teachername,psb.qorder,psb.qn
160
             order by teachername,psb.qorder,psb.qn
163
         </if>
161
         </if>
164
         <if test="correcttype==2">
162
         <if test="correcttype==2">
165
             select pct.teacherid,u.username as teachername
163
             select pct.teacherid,u.username as teachername
166
-            ,if(pc.dispenseway=2,count(psb.mpsqid)*pc.checktype
167
-            ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsqid,null))
168
-            ) as totalNum
169
-            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime>0) or (psb.secondcid=pct.teacherid and psb.secondctime>0),psb.mpsqid,null)) as checkedNum
170
-            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime=0) or (psb.secondcid=pct.teacherid and psb.secondctime=0),psb.mpsqid,null)) as uncheckedNum
164
+            ,if(pc.dispenseway=2,count(distinct psb.mpsqid),count(distinct pctt.mpcttid)) as totalNum
165
+            ,count(distinct if(pctt.checkstate=3,pctt.mpcttid,null)) as checkedNum
166
+            ,if(pc.dispenseway=2,count(distinct if(psb.checked=1 or pctt.checkstate!=3
167
+            or (pc.checktype=2 and (psb.firstcid is null or psb.secondcid is null)),psb.mpsqid,null))
168
+            ,count(distinct if(pctt.checkstate!=3,pctt.mpcttid,null))) as uncheckedNum
171
             ,pct.mblockid,psb.qorder,psb.qn
169
             ,pct.mblockid,psb.qorder,psb.qn
172
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
170
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
173
             left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
171
             left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
174
-            left join ms_paper_student_question psb on psb.mptqid = pct.mblockid and pct.mpid = psb.mpid
172
+            left join ms_paper_student_question psb on pct.mblockid = psb.mptqid and pct.mpid = psb.mpid and psb.answered=1
173
+            left join ms_paper_check_teacher_task pctt on pctt.mpid = pct.mpid and pctt.mpsbid=psb.mpsqid and pctt.teacherid = pct.teacherid
175
             where pct.mpid=#{mpid}
174
             where pct.mpid=#{mpid}
176
             group by pct.teacherid,pct.mblockid
175
             group by pct.teacherid,pct.mblockid
177
             order by teachername,psb.qorder,psb.qn
176
             order by teachername,psb.qorder,psb.qn
178
         </if>
177
         </if>
179
         <if test="correcttype==3">
178
         <if test="correcttype==3">
180
             select pct.teacherid,u.username as teachername
179
             select pct.teacherid,u.username as teachername
181
-            ,if(pc.dispenseway=2,count(psb.mpsbid)*pc.checktype
182
-                ,count(if(psb.firstcid=pct.teacherid or psb.secondcid=pct.teacherid,psb.mpsbid,null))
183
-             ) as totalNum
184
-            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime>0) or (psb.secondcid=pct.teacherid and psb.secondctime>0),psb.mpsbid,null)) as checkedNum
185
-            ,count(if((psb.firstcid=pct.teacherid and psb.firstcime=0) or (psb.secondcid=pct.teacherid and psb.secondctime=0),psb.mpsbid,null)) as uncheckedNum
180
+            ,if(pc.dispenseway=2,count(psb.mpsbid),count(distinct pctt.mpcttid)) as totalNum
181
+            ,count(distinct if(pctt.checkstate=3,pctt.mpcttid,null)) as checkedNum
182
+            ,if(pc.dispenseway=2,count(distinct if(psb.checked=1 or pctt.checkstate!=3
183
+            or (pc.checktype=2 and (psb.firstcid is null or psb.secondcid is null)),psb.mpsbid,null))
184
+            ,count(distinct if(pctt.checkstate!=3,pctt.mpcttid,null))) as uncheckedNum
186
             ,pct.mblockid,pb.blockname
185
             ,pct.mblockid,pb.blockname
187
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
186
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
188
             left join ms_paper_block pb on pct.mblockid = pb.mblockid and pct.mpid = pb.mpid
187
             left join ms_paper_block pb on pct.mblockid = pb.mblockid and pct.mpid = pb.mpid
189
             left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
188
             left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
190
             left join ms_paper_student_block psb on psb.mblockid = pct.mblockid and pct.mpid = psb.mpid
189
             left join ms_paper_student_block psb on psb.mblockid = pct.mblockid and pct.mpid = psb.mpid
190
+            left join ms_paper_check_teacher_task pctt on pctt.mpid = pct.mpid and pctt.mpsbid=psb.mpsbid and pctt.teacherid = pct.teacherid
191
             where pct.mpid=#{mpid}
191
             where pct.mpid=#{mpid}
192
             group by pct.teacherid,pct.mblockid
192
             group by pct.teacherid,pct.mblockid
193
             order by teachername,pb.blockorder
193
             order by teachername,pb.blockorder
257
         <if test="param.correcttype==3">
257
         <if test="param.correcttype==3">
258
             select pb.blockname,pb.blockorder,pb.bqnum
258
             select pb.blockname,pb.blockorder,pb.bqnum
259
             ,pc.mblockid,pc.checktype,pc.dispenseway,pc.numtype
259
             ,pc.mblockid,pc.checktype,pc.dispenseway,pc.numtype
260
-            ,count(distinct psb.mpsbid) as totalNum
260
+            ,count(psb.mpsbid) as totalNum
261
             ,count(distinct if(psb.checked=3,psb.mpsbid,null)) as totalCheckedNum
261
             ,count(distinct if(psb.checked=3,psb.mpsbid,null)) as totalCheckedNum
262
             ,count(distinct if(psb.checked in(1,2),psb.mpsbid,null)) as totalUncheckedNum
262
             ,count(distinct if(psb.checked in(1,2),psb.mpsbid,null)) as totalUncheckedNum
263
-            ,count(distinct if((psb.firstcime is not null and psb.firstcid=#{param.handleid}) or (psb.secondctime is not null and psb.secondcid=#{param.handleid}),psb.mpsbid,null)) as myCheckedNum
264
-            ,count(distinct if(((psb.firstcime is null and psb.firstcid=#{param.handleid})
265
-            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or psb.checked=1)
266
-            ,psb.mpsbid,null)) as myUncheckedNum
263
+            ,count(distinct if(pctt.checkstate=3,pctt.mpcttid,null)) as myCheckedNum
264
+            ,if(pc.dispenseway=2,count(distinct if(psb.checked=1 or pctt.checkstate!=3
265
+            or (pc.checktype=2 and (psb.firstcid is null or psb.secondcid is null)),psb.mpsbid,null))
266
+            ,count(distinct if(pctt.checkstate!=3,pctt.mpcttid,null))) as myUncheckedNum
267
             ,(select group_concat(pbbq.bqn separator '、') from ms_paper_block_question pbbq where pbbq.mblockid = pb.mblockid) as bqn
267
             ,(select group_concat(pbbq.bqn separator '、') from ms_paper_block_question pbbq where pbbq.mblockid = pb.mblockid) as bqn
268
             from ms_paper_check pc left join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
268
             from ms_paper_check pc left join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
269
-            and (psb.firstcid = #{param.handleid} or psb.secondcid = #{param.handleid} or psb.checked=1) and psb.checked!=0
269
+            and psb.checked!=0
270
             inner join ms_paper_block pb on pc.mblockid = pb.mblockid and pb.mpid = pc.mpid
270
             inner join ms_paper_block pb on pc.mblockid = pb.mblockid and pb.mpid = pc.mpid
271
             inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid and pct.teacherid = #{param.handleid}
271
             inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid and pct.teacherid = #{param.handleid}
272
+            left join ms_paper_check_teacher_task pctt on pctt.mpid = pct.mpid and pctt.mpsbid=psb.mpsbid and pctt.teacherid = pct.teacherid
272
             where pc.mpid=#{param.mpid}
273
             where pc.mpid=#{param.mpid}
273
             group by pb.mblockid
274
             group by pb.mblockid
274
             order by pb.blockorder
275
             order by pb.blockorder
279
             ,count(distinct psb.mpsqid) as totalNum
280
             ,count(distinct psb.mpsqid) as totalNum
280
             ,count(distinct if(psb.checked=3,psb.mpsqid,null)) as totalCheckedNum
281
             ,count(distinct if(psb.checked=3,psb.mpsqid,null)) as totalCheckedNum
281
             ,count(distinct if(psb.checked in(1,2),psb.mpsqid,null)) as totalUncheckedNum
282
             ,count(distinct if(psb.checked in(1,2),psb.mpsqid,null)) as totalUncheckedNum
282
-            ,count(distinct if((psb.firstcime>0 and psb.firstcid=#{param.handleid}) or (psb.secondctime>0 and psb.secondcid=#{param.handleid}),psb.mpsqid,null)) as myCheckedNum
283
-            ,count(distinct if(((psb.firstcime is null and psb.firstcid=#{param.handleid})
284
-            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or psb.checked=1)
285
-            ,psb.mpsqid,null)) as myUncheckedNum
283
+            ,count(distinct if(pctt.checkstate=3,pctt.mpcttid,null)) as myCheckedNum
284
+            ,if(pc.dispenseway=2,count(distinct if(psb.checked=1 or pctt.checkstate!=3
285
+            or (pc.checktype=2 and (psb.firstcid is null or psb.secondcid IS NULL)),psb.mpsqid,null))
286
+            ,count(distinct if(pctt.checkstate!=3,pctt.mpcttid,null))) as myUncheckedNum
286
             from ms_paper_check pc left join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
287
             from ms_paper_check pc left join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
287
-            and (psb.firstcid = #{param.handleid} or psb.secondcid = #{param.handleid} or psb.checked=1) and psb.checked!=0
288
+            and psb.checked!=0 and psb.answered=1
288
             inner join ms_paper_qtype_question pb on pc.mblockid = pb.mptqid and pb.mpid = pc.mpid
289
             inner join ms_paper_qtype_question pb on pc.mblockid = pb.mptqid and pb.mpid = pc.mpid
289
             inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid and pct.teacherid = #{param.handleid}
290
             inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid and pct.teacherid = #{param.handleid}
291
+            left join ms_paper_check_teacher_task pctt on pctt.mpid = pct.mpid and pctt.mpsbid=psb.mpsqid and pctt.teacherid = pct.teacherid
290
             where pc.mpid=#{param.mpid}
292
             where pc.mpid=#{param.mpid}
291
             group by pb.mptqid
293
             group by pb.mptqid
292
             order by pb.mptqid
294
             order by pb.mptqid
294
         <if test="param.correcttype==1">
296
         <if test="param.correcttype==1">
295
             select c.classname,c.classtype
297
             select c.classname,c.classtype
296
             ,pc.mblockid,pc.checktype,pc.dispenseway,pc.numtype
298
             ,pc.mblockid,pc.checktype,pc.dispenseway,pc.numtype
297
-            ,count(distinct psb.mpsqid)*pc.checktype as totalNum
299
+            ,count(distinct psb.mpsqid) as totalNum
298
             ,count(distinct if(psb.checked=3,psb.mpsqid,null)) as totalCheckedNum
300
             ,count(distinct if(psb.checked=3,psb.mpsqid,null)) as totalCheckedNum
299
             ,count(distinct if(psb.checked in(1,2),psb.mpsqid,null)) as totalUncheckedNum
301
             ,count(distinct if(psb.checked in(1,2),psb.mpsqid,null)) as totalUncheckedNum
300
-            ,count(distinct if((psb.firstcime is not null and psb.firstcid=#{param.handleid}) or (psb.secondctime is not null and psb.secondcid=#{param.handleid}),psb.mpsqid,null)) as myCheckedNum
301
-            ,count(distinct if(((psb.firstcime is null and psb.firstcid=#{param.handleid})
302
-            or (psb.secondctime is null and psb.secondcid=#{param.handleid}) or psb.checked=1)
303
-            ,psb.mpsqid,null)) as myUncheckedNum
302
+            ,count(distinct if(pctt.checkstate=3,pctt.mpcttid,null)) as myCheckedNum
303
+            ,if(pc.dispenseway=2,count(distinct if(psb.checked=1 or pctt.checkstate!=3
304
+            or (pc.checktype=2 and (psb.firstcid is null or psb.secondcid IS NULL)),psb.mpsqid,null))
305
+            ,count(distinct if(pctt.checkstate!=3,pctt.mpcttid,null))) as myUncheckedNum
304
             from ms_paper_check pc inner join ms_class c on pc.mblockid = c.classid
306
             from ms_paper_check pc inner join ms_class c on pc.mblockid = c.classid
305
             inner join ms_class_student cs on c.examid=cs.examid and c.subjectid=cs.subjectid and pc.mblockid=cs.classid
307
             inner join ms_class_student cs on c.examid=cs.examid and c.subjectid=cs.subjectid and pc.mblockid=cs.classid
306
             inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid and pct.teacherid = #{param.handleid}
308
             inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid=pc.mpid and pct.teacherid = #{param.handleid}
307
-            left join ms_paper_student_question psb on psb.mpid = pc.mpid and psb.studentid=cs.studentid
308
-            and (psb.firstcid = #{param.handleid} or psb.secondcid = #{param.handleid} or psb.checked=1) and psb.checked!=0
309
+            left join ms_paper_student_question psb on psb.mpid = pc.mpid and psb.studentid=cs.studentid and psb.checked!=0 and psb.answered=1
310
+            left join ms_paper_check_teacher_task pctt on pctt.mpid = pct.mpid and pctt.mpsbid=psb.mpsqid and pctt.teacherid = pct.teacherid
309
             where pc.mpid=#{param.mpid} and c.subjectid=#{param.subjectid}
311
             where pc.mpid=#{param.mpid} and c.subjectid=#{param.subjectid}
310
             group by c.classid
312
             group by c.classid
311
             order by c.mcid
313
             order by c.mcid
366
         from ms_paper_check pc inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
368
         from ms_paper_check pc inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
367
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
369
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
368
         where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
370
         where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
371
+        <if test="param.mblockid!=null and param.mblockid!=0">
372
+            and pc.mblockid=#{param.mblockid}
373
+        </if>
369
         group by pc.mblockid
374
         group by pc.mblockid
370
         order by pc.mpcid
375
         order by pc.mpcid
371
     </select>
376
     </select>
499
         from ms_paper_check pc inner join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
504
         from ms_paper_check pc inner join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
500
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
505
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
501
         where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
506
         where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
507
+        <if test="param.mblockid!=null and param.mblockid!=0">
508
+            and pc.mblockid=#{param.mblockid}
509
+        </if>
502
         group by pc.mblockid
510
         group by pc.mblockid
503
         order by pc.mpcid
511
         order by pc.mpcid
504
     </select>
512
     </select>
539
         from ms_paper_check pc inner join ms_paper_student_question psb on psb.mpid = pc.mpid
547
         from ms_paper_check pc inner join ms_paper_student_question psb on psb.mpid = pc.mpid
540
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
548
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
541
         where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
549
         where pc.checkstate=1 and psb.checked in(1,2) and pc.mpid=#{param.mpid}
550
+        <if test="param.mblockid!=null and param.mblockid!=0">
551
+            and pc.mblockid=#{param.mblockid}
552
+        </if>
553
+        <if test="param.mptqid!=null and param.mptqid!=0">
554
+            and psb.mptqid=#{param.mptqid}
555
+        </if>
542
         group by pc.mblockid
556
         group by pc.mblockid
543
         order by pc.mpcid
557
         order by pc.mpcid
544
     </select>
558
     </select>

Loading…
Cancel
Save