|
@@ -1309,39 +1309,41 @@
|
|
|
from
|
|
|
exam_detail ed
|
|
|
where
|
|
|
- ed.school_id = et.school_id
|
|
|
- and ed.exam_id = et.exam_id
|
|
|
+ ed.school_id = t.schoolId
|
|
|
+ and ed.exam_id = t.examId
|
|
|
and exists(
|
|
|
select
|
|
|
edc.id
|
|
|
from
|
|
|
exam_detail_course edc
|
|
|
where
|
|
|
- edc.paper_number = et.paper_number
|
|
|
+ edc.paper_number = t.paperNumber
|
|
|
and edc.exam_detail_id = ed.id
|
|
|
</sql>
|
|
|
|
|
|
<sql id="printCountCommon">
|
|
|
- select
|
|
|
+ select t.*,
|
|
|
+ if(t.unGenerated = 0 and t.unPrinted = 0,'FINISH','UN_FINISH') as finishStatus from(select
|
|
|
t.*,
|
|
|
ec.type as cardType,
|
|
|
- if(t.unGenerated = 0 and t.unPrinted = 0,'FINISH','UN_FINISH') as finishStatus
|
|
|
+ (<include refid="printStatusCount" />)) as totalExamination,
|
|
|
+ (<include refid="printStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING', 'FINISH'))) as generate,
|
|
|
+ (<include refid="printStatusCount" /> and ed.status in ('NEW', 'CREATING'))) as unGenerated,
|
|
|
+ (<include refid="printStatusCount" /> and ed.status = 'FINISH')) as printed,
|
|
|
+ (<include refid="printStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING'))) as unPrinted,
|
|
|
+ (<include refid="printStatusCount" /> and ed.status = 'CANCEL')) as invalid,
|
|
|
+ (<include refid="printStatusCount" /> and ed.status = 'REJECT')) as reject
|
|
|
from
|
|
|
(
|
|
|
select distinct
|
|
|
et.id,
|
|
|
+ et.school_id as schoolId,
|
|
|
+ et.exam_id as examId,
|
|
|
bc.name as courseName,
|
|
|
bc.code as courseCode,
|
|
|
et.paper_number as paperNumber,
|
|
|
replace(substring_index(substring_index(convert((etd.paper_attachment_ids ->>'$[*].cardId') using utf8), ']', 1), '[',-1), '"', '') as cardId,
|
|
|
- so.name as college,
|
|
|
- (<include refid="printStatusCount" />)) as totalExamination,
|
|
|
- (<include refid="printStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING', 'FINISH'))) as generate,
|
|
|
- (<include refid="printStatusCount" /> and ed.status in ('NEW', 'CREATING'))) as unGenerated,
|
|
|
- (<include refid="printStatusCount" /> and ed.status = 'FINISH')) as printed,
|
|
|
- (<include refid="printStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING'))) as unPrinted,
|
|
|
- (<include refid="printStatusCount" /> and ed.status = 'CANCEL')) as invalid,
|
|
|
- (<include refid="printStatusCount" /> and ed.status = 'REJECT')) as reject
|
|
|
+ so.name as college
|
|
|
from exam_task et
|
|
|
left join basic_course bc on bc.id = et.course_id
|
|
|
left join exam_task_detail etd on etd.exam_task_id = et.id
|
|
@@ -1390,10 +1392,13 @@
|
|
|
</if>
|
|
|
</where>) t
|
|
|
left join exam_card ec on ec.id = t.cardId
|
|
|
+ <where>
|
|
|
+ <if test="cardType != null and cardType != ''">
|
|
|
+ AND ec.type = #{cardType}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) t
|
|
|
<where>
|
|
|
- <if test="cardType != null and cardType != ''">
|
|
|
- AND ec.type = #{cardType}
|
|
|
- </if>
|
|
|
<if test="finishStatus != null and finishStatus != ''">
|
|
|
<choose>
|
|
|
<when test="finishStatus == 'FINISH'">
|
|
@@ -1419,9 +1424,20 @@
|
|
|
<sql id="scanCountCommon">
|
|
|
select
|
|
|
t.*,
|
|
|
- ec.type as cardType,
|
|
|
IF(t.studentCount <![CDATA[ > ]]> 0 ,ROUND(t.scanUploadCount / t.studentCount * 100, 2) ,0) as scanUploadRate
|
|
|
from
|
|
|
+ (select
|
|
|
+ t.id,
|
|
|
+ t.college,
|
|
|
+ t.courseName,
|
|
|
+ t.courseCode,
|
|
|
+ t.paperNumber,
|
|
|
+ t.studentCount,
|
|
|
+ t.absentCount,
|
|
|
+ ec.type as cardType,
|
|
|
+ ROUND(sum(t.sheetCount) / 2, 2) as sheetCount,
|
|
|
+ sum(case when t.isUpload = 1 then 1 else 0 end) as scanUploadCount
|
|
|
+ from
|
|
|
(
|
|
|
select
|
|
|
distinct
|
|
@@ -1430,11 +1446,11 @@
|
|
|
bc.name as courseName,
|
|
|
bc.code as courseCode,
|
|
|
mp.paper_number as paperNumber,
|
|
|
- replace(substring_index(substring_index(convert((etd.paper_attachment_ids ->>'$[*].cardId') using utf8), ']', 1), '[',-1), '"', '') as cardId,
|
|
|
IFNULL(mp.student_count, 0) as studentCount,
|
|
|
- if(ROUND(sum(ms.sheet_count) / 2, 2) <![CDATA[ < ]]> 0,0,ROUND(sum(ms.sheet_count) / 2, 2)) as sheetCount,
|
|
|
+ IFNULL(ms.sheet_count, 0) as sheetCount,
|
|
|
IFNULL(mp.absent_count, 0) as absentCount,
|
|
|
- sum(case when ms.is_upload = 1 then 1 else 0 end) as scanUploadCount
|
|
|
+ IFNULL(ms.is_upload, 0) as isUpload,
|
|
|
+ replace(substring_index(substring_index(convert((etd.paper_attachment_ids ->>'$[*].cardId') using utf8), ']', 1), '[',-1), '"', '') as cardId
|
|
|
from mark_paper mp
|
|
|
left join basic_exam be on be.id = mp.exam_id and be.enable = true
|
|
|
left join basic_semester bs on bs.id = be.semester_id and bs.enable = true
|
|
@@ -1480,23 +1496,19 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</if>
|
|
|
- </where>
|
|
|
- group by
|
|
|
- mp.id,
|
|
|
- bc.name,
|
|
|
- bc.code,
|
|
|
- mp.paper_number,
|
|
|
- etd.paper_attachment_ids,
|
|
|
- mp.student_count,
|
|
|
- ms.sheet_count,
|
|
|
- mp.absent_count,
|
|
|
- ms.is_upload) t
|
|
|
+ </where>) t
|
|
|
left join exam_card ec on ec.id = t.cardId
|
|
|
<where>
|
|
|
<if test="cardType != null and cardType != ''">
|
|
|
AND ec.type = #{cardType}
|
|
|
</if>
|
|
|
</where>
|
|
|
+ group by
|
|
|
+ t.id,
|
|
|
+ t.college,
|
|
|
+ t.courseName,
|
|
|
+ t.courseCode,
|
|
|
+ t.paperNumber) t
|
|
|
order by t.paperNumber desc
|
|
|
</sql>
|
|
|
|