|
@@ -1430,21 +1430,17 @@
|
|
|
</select>
|
|
|
|
|
|
<sql id="scanCountCommon">
|
|
|
- select
|
|
|
- t.*,
|
|
|
- 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,
|
|
|
- GROUP_CONCAT(distinct 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
|
|
|
+ select t.* from(select
|
|
|
+ t.id,
|
|
|
+ t.college,
|
|
|
+ t.courseName,
|
|
|
+ t.courseCode,
|
|
|
+ t.paperNumber,
|
|
|
+ t.studentCount,
|
|
|
+ t.absentCount,
|
|
|
+ IF(t.studentCount > 0 ,ROUND(t.isUpload / t.studentCount * 100, 2) ,0) as scanUploadRate,
|
|
|
+ GROUP_CONCAT(distinct ec.type) as cardType,
|
|
|
+ ROUND(t.sheetCount / 2, 2) as sheetCount
|
|
|
from
|
|
|
(
|
|
|
select
|
|
@@ -1455,20 +1451,23 @@
|
|
|
bc.code as courseCode,
|
|
|
mp.paper_number as paperNumber,
|
|
|
IFNULL(mp.student_count, 0) as studentCount,
|
|
|
- IFNULL(ms.sheet_count, 0) as sheetCount,
|
|
|
+ sum(ms.sheet_count) as sheetCount,
|
|
|
IFNULL(mp.absent_count, 0) as absentCount,
|
|
|
- IFNULL(ms.is_upload, 0) as isUpload,
|
|
|
- concat(replace(substring_index(substring_index(convert((etd.paper_attachment_ids ->>'$[*].cardId') using utf8), ']', 1), '[',-1), '"', ''),', ') as cardId
|
|
|
+ sum(case when ms.is_upload = 1 then 1 else 0 end) as isUpload,
|
|
|
+ concat(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
|
|
|
left join basic_course bc on bc.id = mp.course_id
|
|
|
left join sys_org so on so.id = bc.teaching_room_id
|
|
|
- left join exam_task et on et.exam_id = mp.exam_id and et.course_id = mp.course_id and et.paper_number = mp.paper_number
|
|
|
+ left join exam_task et on et.exam_id = mp.exam_id and et.course_id = mp.course_id and et.paper_number =
|
|
|
+ mp.paper_number
|
|
|
left join exam_task_detail etd on etd.exam_task_id = et.id
|
|
|
- left join mark_student ms on ms.exam_id = mp.exam_id and ms.course_id = mp.course_id and ms.paper_Number = mp.paper_Number
|
|
|
- <where> 1 = 1
|
|
|
- <if test="schoolId != null and schoolId != ''">
|
|
|
+ left join mark_student ms on ms.exam_id = mp.exam_id and ms.course_id = mp.course_id and ms.paper_Number =
|
|
|
+ mp.paper_Number<where>
|
|
|
+ 1 = 1
|
|
|
+ <if test="schoolId != null and schoolId != ''">
|
|
|
AND bs.school_id = #{schoolId}
|
|
|
</if>
|
|
|
<if test="semesterId != null and semesterId != ''">
|
|
@@ -1488,14 +1487,20 @@
|
|
|
</if>
|
|
|
<if test="dpr != null">
|
|
|
<if test="dpr.requestUserId != null">
|
|
|
- AND EXISTS( SELECT 1 FROM (select exam_id, paper_number,basic_student_id from mark_student where exam_id = #{examId}
|
|
|
+ AND EXISTS( SELECT 1 FROM (select exam_id, paper_number,basic_student_id from mark_student where
|
|
|
+ exam_id
|
|
|
+ = #{examId}
|
|
|
<if test="paperNumber != null and paperNumber != ''">
|
|
|
AND paper_number = #{paperNumber}
|
|
|
</if>
|
|
|
- ) ms join (select id from basic_exam_student where exam_id = #{examId} and teacher_id = #{dpr.requestUserId}) bes on ms.basic_student_id = bes.id WHERE mp.exam_id = ms.exam_id and mp.paper_number = ms.paper_number)
|
|
|
+ ) ms join (select id from basic_exam_student where exam_id = #{examId} and teacher_id = #{
|
|
|
+ dpr.requestUserId}) bes on ms.basic_student_id = bes.id WHERE mp.exam_id = ms.exam_id and mp.
|
|
|
+ paper_number = ms.paper_number)
|
|
|
</if>
|
|
|
<if test="dpr.courseUserId != null">
|
|
|
- AND EXISTS( SELECT 1 FROM (select course_id from teach_course where exam_id = #{examId} and user_id = #{dpr.courseUserId}) tc WHERE tc.course_id = mp.course_id)
|
|
|
+ AND EXISTS( SELECT 1 FROM (select course_id from teach_course where exam_id = #{examId} and user_id
|
|
|
+ = #{
|
|
|
+ dpr.courseUserId}) tc WHERE tc.course_id = mp.course_id)
|
|
|
</if>
|
|
|
<if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
|
|
|
AND bc.teaching_room_id IN
|
|
@@ -1504,8 +1509,15 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</if>
|
|
|
- </where>) t
|
|
|
- left join tmp_help_topic b on b.help_topic_id <![CDATA[ < ]]> (LENGTH(t.cardId) - LENGTH( REPLACE (t.cardId, ', ', '' ) ) + 1 )
|
|
|
+ </where>
|
|
|
+ group by
|
|
|
+ mp.id,
|
|
|
+ so.name,
|
|
|
+ bc.name,
|
|
|
+ bc.code,
|
|
|
+ mp.paper_number) t
|
|
|
+ left join tmp_help_topic b on b.help_topic_id <![CDATA[ < ]]> (LENGTH(t.cardId) - LENGTH( REPLACE (t.cardId,
|
|
|
+ ', ', '' ) ) + 1 )
|
|
|
left join exam_card ec on ec.id in (SUBSTRING_INDEX(SUBSTRING_INDEX(t.cardId, ', ', b.help_topic_id), ', ',-1))
|
|
|
<where>
|
|
|
<if test="cardType != null and cardType != ''">
|
|
@@ -1518,6 +1530,7 @@
|
|
|
t.courseName,
|
|
|
t.courseCode,
|
|
|
t.paperNumber) t
|
|
|
+ where t.paperNumber is not null
|
|
|
order by t.paperNumber desc
|
|
|
</sql>
|
|
|
|