|
@@ -3,19 +3,23 @@
|
|
|
<mapper namespace="com.qmth.distributed.print.business.mapper.TCStatisticsMapper">
|
|
|
|
|
|
<select id="list" resultType="com.qmth.distributed.print.business.bean.dto.TCStatisticsDto">
|
|
|
- select
|
|
|
+ select temp.* from(select
|
|
|
t.id,
|
|
|
+ t.collegeId,
|
|
|
+ t.collegeName,
|
|
|
+ t.teachingRoomId,
|
|
|
+ t.teachingRoomName,
|
|
|
t.courseName,
|
|
|
t.courseCode,
|
|
|
t.teacherName,
|
|
|
t.clazzId,
|
|
|
t.clazzName,
|
|
|
- t.paperNumber,
|
|
|
+ IF(t.examStudentCount = 0,null,t.paperNumber) as paperNumber,
|
|
|
t.printPlanId,
|
|
|
- t.printPlanName,
|
|
|
+ IF(t.examStudentCount = 0,null,t.printPlanName) as printPlanName,
|
|
|
t.examStudentCount,
|
|
|
- IFNULL(t.examStudentCount, 0) + (t.drawCount * t.backupCount) as printSum,
|
|
|
- t.status
|
|
|
+ IF(t.examStudentCount = 0,null,t.examStudentCount + (t.drawCount * t.backupCount)) as printSum,
|
|
|
+ IF(t.examStudentCount = 0,null,t.status) as status
|
|
|
from
|
|
|
(
|
|
|
select
|
|
@@ -41,7 +45,7 @@
|
|
|
where
|
|
|
FIND_IN_SET(etd.id, tcs.exam_task_detail_ids)) as drawCount,
|
|
|
IFNULL(epp.backup_count, 0) as backupCount,
|
|
|
- (
|
|
|
+ IFNULL((
|
|
|
select
|
|
|
count(1)
|
|
|
from
|
|
@@ -49,7 +53,7 @@
|
|
|
where
|
|
|
FIND_IN_SET(es.exam_detail_course_id, tcs.exam_detail_course_ids)
|
|
|
and es.clazz_id = tcs.clazz_id
|
|
|
- and es.school_id = 137) as examStudentCount,
|
|
|
+ and es.school_id = #{schoolId}),0) as examStudentCount,
|
|
|
case
|
|
|
when epp.status = 'PRINT_FINISH'
|
|
|
or epp.status = 'END' then 'FINISH'
|
|
@@ -60,22 +64,22 @@
|
|
|
join exam_print_plan epp on
|
|
|
epp.id = tcs.print_plan_id
|
|
|
where
|
|
|
- epp.school_id = #{schoolId}) t
|
|
|
+ epp.school_id = #{schoolId}) t) temp
|
|
|
<where>
|
|
|
<if test="collegeId != null and collegeId != ''">
|
|
|
- and t.collegeId = #{collegeId}
|
|
|
+ and temp.collegeId = #{collegeId}
|
|
|
</if>
|
|
|
<if test="teachingRoomId != null and teachingRoomId != ''">
|
|
|
- and t.teachingRoomId = #{teachingRoomId}
|
|
|
+ and temp.teachingRoomId = #{teachingRoomId}
|
|
|
</if>
|
|
|
<if test="status != null and status != ''">
|
|
|
- and t.status = #{status}
|
|
|
+ and temp.status = #{status}
|
|
|
</if>
|
|
|
<if test="courseName != null and courseName != ''">
|
|
|
- and t.courseName like concat('%',#{courseName},'%')
|
|
|
+ and temp.courseName like concat('%',#{courseName},'%')
|
|
|
</if>
|
|
|
<if test="teacherName != null and teacherName != ''">
|
|
|
- and t.teacherName like concat('%',#{teacherName},'%')
|
|
|
+ and temp.teacherName like concat('%',#{teacherName},'%')
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
@@ -96,7 +100,10 @@
|
|
|
t.printPlanName,
|
|
|
t.batchNo,
|
|
|
t.status,
|
|
|
- IFNULL(sum(t.examStudentCount),0) + (t.drawCount * t.backupCount) as printSum,
|
|
|
+ case
|
|
|
+ when sum(t.examStudentCount) = 0 then 0
|
|
|
+ else sum(t.examStudentCount) + (t.drawCount * t.backupCount)
|
|
|
+ end printSum,
|
|
|
GROUP_CONCAT(distinct t.examDetailCourseId) as examDetailCourseIds,
|
|
|
GROUP_CONCAT(distinct t.examTaskDetailId) as examTaskDetailIds
|
|
|
from
|
|
@@ -119,7 +126,7 @@
|
|
|
epp.id as printPlanId,
|
|
|
epp.name as printPlanName,
|
|
|
IFNULL(etd.draw_count, 0) as drawCount,
|
|
|
- (
|
|
|
+ IFNULL((
|
|
|
select
|
|
|
count(1)
|
|
|
from
|
|
@@ -127,7 +134,7 @@
|
|
|
where
|
|
|
es.exam_detail_course_id = edc.id
|
|
|
and es.clazz_id = tcst.clazz_id
|
|
|
- and es.school_id = #{schoolId}) as examStudentCount,
|
|
|
+ and es.school_id = #{schoolId}),0) as examStudentCount,
|
|
|
IFNULL(epp.backup_count, 0) as backupCount,
|
|
|
case
|
|
|
when epp.status = 'PRINT_FINISH'
|