Quellcode durchsuchen

批阅完善

ywx
雍文秀 vor 1 Monat
Ursprung
Commit
4ec0bf66f4

+ 49
- 35
smarking/src/main/resources/mapper/papercheck/MsPaperCheckTeacherTaskMapper.xml Datei anzeigen

@@ -147,47 +147,47 @@
147 147
     <select id="listByTeacher" resultMap="teacherResultMap">
148 148
         <if test="correcttype==1">
149 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 153
             ,psb.mptqid as mblockid,psb.qorder,psb.qn
156 154
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
157 155
             left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
158 156
             left join ms_paper_student_question psb on pct.mpid = psb.mpid
159 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 159
             group by pct.teacherid,psb.mptqid
162 160
             order by teachername,psb.qorder,psb.qn
163 161
         </if>
164 162
         <if test="correcttype==2">
165 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 169
             ,pct.mblockid,psb.qorder,psb.qn
172 170
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
173 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 174
             where pct.mpid=#{mpid}
176 175
             group by pct.teacherid,pct.mblockid
177 176
             order by teachername,psb.qorder,psb.qn
178 177
         </if>
179 178
         <if test="correcttype==3">
180 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 185
             ,pct.mblockid,pb.blockname
187 186
             from ms_paper_check_teacher pct left join t_user u on u.userid = pct.teacherid
188 187
             left join ms_paper_block pb on pct.mblockid = pb.mblockid and pct.mpid = pb.mpid
189 188
             left join ms_paper_check pc on pct.mblockid = pc.mblockid and pct.mpid = pc.mpid
190 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 191
             where pct.mpid=#{mpid}
192 192
             group by pct.teacherid,pct.mblockid
193 193
             order by teachername,pb.blockorder
@@ -257,18 +257,19 @@
257 257
         <if test="param.correcttype==3">
258 258
             select pb.blockname,pb.blockorder,pb.bqnum
259 259
             ,pc.mblockid,pc.checktype,pc.dispenseway,pc.numtype
260
-            ,count(distinct psb.mpsbid) as totalNum
260
+            ,count(psb.mpsbid) as totalNum
261 261
             ,count(distinct if(psb.checked=3,psb.mpsbid,null)) as totalCheckedNum
262 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 267
             ,(select group_concat(pbbq.bqn separator '、') from ms_paper_block_question pbbq where pbbq.mblockid = pb.mblockid) as bqn
268 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 270
             inner join ms_paper_block pb on pc.mblockid = pb.mblockid and pb.mpid = pc.mpid
271 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 273
             where pc.mpid=#{param.mpid}
273 274
             group by pb.mblockid
274 275
             order by pb.blockorder
@@ -279,14 +280,15 @@
279 280
             ,count(distinct psb.mpsqid) as totalNum
280 281
             ,count(distinct if(psb.checked=3,psb.mpsqid,null)) as totalCheckedNum
281 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 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 289
             inner join ms_paper_qtype_question pb on pc.mblockid = pb.mptqid and pb.mpid = pc.mpid
289 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 292
             where pc.mpid=#{param.mpid}
291 293
             group by pb.mptqid
292 294
             order by pb.mptqid
@@ -294,18 +296,18 @@
294 296
         <if test="param.correcttype==1">
295 297
             select c.classname,c.classtype
296 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 300
             ,count(distinct if(psb.checked=3,psb.mpsqid,null)) as totalCheckedNum
299 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 306
             from ms_paper_check pc inner join ms_class c on pc.mblockid = c.classid
305 307
             inner join ms_class_student cs on c.examid=cs.examid and c.subjectid=cs.subjectid and pc.mblockid=cs.classid
306 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 311
             where pc.mpid=#{param.mpid} and c.subjectid=#{param.subjectid}
310 312
             group by c.classid
311 313
             order by c.mcid
@@ -366,6 +368,9 @@
366 368
         from ms_paper_check pc inner join ms_paper_student_block psb on psb.mblockid = pc.mblockid and psb.mpid = pc.mpid
367 369
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
368 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 374
         group by pc.mblockid
370 375
         order by pc.mpcid
371 376
     </select>
@@ -499,6 +504,9 @@
499 504
         from ms_paper_check pc inner join ms_paper_student_question psb on psb.mptqid = pc.mblockid and psb.mpid = pc.mpid
500 505
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
501 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 510
         group by pc.mblockid
503 511
         order by pc.mpcid
504 512
     </select>
@@ -539,6 +547,12 @@
539 547
         from ms_paper_check pc inner join ms_paper_student_question psb on psb.mpid = pc.mpid
540 548
         inner join ms_paper_check_teacher pct on pc.mblockid = pct.mblockid and pct.mpid = pc.mpid and pct.teacherid = #{param.handleid}
541 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 556
         group by pc.mblockid
543 557
         order by pc.mpcid
544 558
     </select>

Laden…
Abbrechen
Speichern