|
@@ -2,7 +2,22 @@
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.qmth.distributed.print.business.mapper.TCStatisticsMapper">
|
|
<mapper namespace="com.qmth.distributed.print.business.mapper.TCStatisticsMapper">
|
|
|
|
|
|
- <select id="findByBatchNo" resultType="com.qmth.distributed.print.business.entity.TCStatistics">
|
|
|
|
|
|
+ <select id="list" resultType="com.qmth.distributed.print.business.bean.dto.TCStatisticsDto">
|
|
|
|
+ select
|
|
|
|
+ t.id,
|
|
|
|
+ t.courseName,
|
|
|
|
+ t.courseCode,
|
|
|
|
+ t.teacherName,
|
|
|
|
+ t.clazzId,
|
|
|
|
+ t.clazzName,
|
|
|
|
+ t.paperNumber,
|
|
|
|
+ t.printPlanId,
|
|
|
|
+ t.printPlanName,
|
|
|
|
+ t.examStudentCount,
|
|
|
|
+ IFNULL(t.examStudentCount, 0) + (t.drawCount * t.backupCount) as printSum,
|
|
|
|
+ t.status
|
|
|
|
+ from
|
|
|
|
+ (
|
|
select
|
|
select
|
|
distinct tcs.id,
|
|
distinct tcs.id,
|
|
tcs.college_id as collegeId,
|
|
tcs.college_id as collegeId,
|
|
@@ -14,69 +29,96 @@
|
|
tcs.teacher_name as teacherName,
|
|
tcs.teacher_name as teacherName,
|
|
tcs.clazz_id as clazzId,
|
|
tcs.clazz_id as clazzId,
|
|
tcs.clazz_name as clazzName,
|
|
tcs.clazz_name as clazzName,
|
|
- tcs.paper_number as paperNumber,
|
|
|
|
tcs.batch_no as batchNo,
|
|
tcs.batch_no as batchNo,
|
|
|
|
+ tcs.paper_number as paperNumber,
|
|
epp.id as printPlanId,
|
|
epp.id as printPlanId,
|
|
- edc.id as examDetailCourseId,
|
|
|
|
- etd.id as examTaskDetailId
|
|
|
|
|
|
+ epp.name as printPlanName,
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ etd.draw_count
|
|
|
|
+ from
|
|
|
|
+ exam_task_detail etd
|
|
|
|
+ where
|
|
|
|
+ FIND_IN_SET(etd.id, tcs.exam_task_detail_ids)) as drawCount,
|
|
|
|
+ IFNULL(epp.backup_count, 0) as backupCount,
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ count(1)
|
|
|
|
+ from
|
|
|
|
+ exam_student es
|
|
|
|
+ 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,
|
|
|
|
+ case
|
|
|
|
+ when epp.status = 'PRINT_FINISH'
|
|
|
|
+ or epp.status = 'END' then 'FINISH'
|
|
|
|
+ else 'UN_FINISH'
|
|
|
|
+ end status
|
|
from
|
|
from
|
|
t_c_statistics tcs
|
|
t_c_statistics tcs
|
|
- join exam_task et on
|
|
|
|
- et.course_code = tcs.course_code
|
|
|
|
- and et.teaching_room_id = tcs.teaching_room_id
|
|
|
|
- join exam_task_detail etd on
|
|
|
|
- etd.exam_task_id = et.id
|
|
|
|
- join exam_detail_course edc on
|
|
|
|
- edc.course_code = tcs.course_code
|
|
|
|
- and edc.paper_number = et.paper_number
|
|
|
|
- and edc.school_id = et.school_id
|
|
|
|
- join exam_detail ed on
|
|
|
|
- ed.id = edc.exam_detail_id
|
|
|
|
join exam_print_plan epp on
|
|
join exam_print_plan epp on
|
|
- epp.id = ed.print_plan_id
|
|
|
|
|
|
+ epp.id = tcs.print_plan_id
|
|
|
|
+ where
|
|
|
|
+ epp.school_id = #{schoolId}) t
|
|
<where>
|
|
<where>
|
|
- and et.enable = true
|
|
|
|
- and etd.enable = true
|
|
|
|
- <if test="schoolId != null and schoolId != ''">
|
|
|
|
- and et.school_id = #{schoolId}
|
|
|
|
|
|
+ <if test="collegeId != null and collegeId != ''">
|
|
|
|
+ and t.collegeId = #{collegeId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="teachingRoomId != null and teachingRoomId != ''">
|
|
|
|
+ and t.teachingRoomId = #{teachingRoomId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null and status != ''">
|
|
|
|
+ and t.status = #{status}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="courseName != null and courseName != ''">
|
|
|
|
+ and t.courseName like concat('%',#{courseName},'%')
|
|
</if>
|
|
</if>
|
|
- <if test="batchNo != null and batchNo != ''">
|
|
|
|
- and tcs.batch_no = #{batchNo}
|
|
|
|
|
|
+ <if test="teacherName != null and teacherName != ''">
|
|
|
|
+ and t.teacherName like concat('%',#{teacherName},'%')
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
- <select id="list" resultType="com.qmth.distributed.print.business.bean.dto.TCStatisticsDto">
|
|
|
|
- select
|
|
|
|
- t.id,
|
|
|
|
- t.courseName,
|
|
|
|
- t.courseCode,
|
|
|
|
- t.teacherName,
|
|
|
|
- t.clazzId,
|
|
|
|
- t.clazzName,
|
|
|
|
- t.paperNumber,
|
|
|
|
- t.printPlanId,
|
|
|
|
- t.printPlanName,
|
|
|
|
- IFNULL(t.examStudentCount,0) + (t.drawCount * t.backupCount) as printSum,
|
|
|
|
- t.status
|
|
|
|
|
|
+ <select id="findByBatchNoCount" resultType="com.qmth.distributed.print.business.bean.dto.TCStatisticsDto">
|
|
|
|
+ select
|
|
|
|
+ t.collegeId,
|
|
|
|
+ t.collegeName,
|
|
|
|
+ t.courseName,
|
|
|
|
+ t.courseCode,
|
|
|
|
+ t.teachingRoomId,
|
|
|
|
+ t.teachingRoomName,
|
|
|
|
+ t.teacherName,
|
|
|
|
+ t.clazzId,
|
|
|
|
+ t.clazzName,
|
|
|
|
+ t.paperNumber,
|
|
|
|
+ t.printPlanId,
|
|
|
|
+ t.printPlanName,
|
|
|
|
+ t.batchNo,
|
|
|
|
+ t.status,
|
|
|
|
+ IFNULL(sum(t.examStudentCount),0) + (t.drawCount * t.backupCount) as printSum,
|
|
|
|
+ GROUP_CONCAT(distinct t.examDetailCourseId) as examDetailCourseIds,
|
|
|
|
+ GROUP_CONCAT(distinct t.examTaskDetailId) as examTaskDetailIds
|
|
from
|
|
from
|
|
(
|
|
(
|
|
select
|
|
select
|
|
- distinct tcs.id,
|
|
|
|
- tcs.college_id as collegeId,
|
|
|
|
- tcs.college_name as collegeName,
|
|
|
|
- tcs.course_name as courseName,
|
|
|
|
- tcs.course_code as courseCode,
|
|
|
|
- tcs.teaching_room_id as teachingRoomId,
|
|
|
|
- tcs.teaching_room_name as teachingRoomName,
|
|
|
|
- tcs.teacher_name as teacherName,
|
|
|
|
- tcs.clazz_id as clazzId,
|
|
|
|
- tcs.clazz_name as clazzName,
|
|
|
|
|
|
+ distinct
|
|
|
|
+ tcst.college_id as collegeId,
|
|
|
|
+ tcst.college_name as collegeName,
|
|
|
|
+ tcst.course_name as courseName,
|
|
|
|
+ et.course_code as courseCode,
|
|
|
|
+ et.teaching_room_id as teachingRoomId,
|
|
|
|
+ tcst.teaching_room_name as teachingRoomName,
|
|
|
|
+ tcst.teacher_name as teacherName,
|
|
|
|
+ tcst.clazz_id as clazzId,
|
|
|
|
+ tcst.clazz_name as clazzName,
|
|
|
|
+ tcst.batch_no as batchNo,
|
|
et.paper_number as paperNumber,
|
|
et.paper_number as paperNumber,
|
|
- tcs.print_plan_id as printPlanId,
|
|
|
|
|
|
+ edc.id as examDetailCourseId,
|
|
|
|
+ etd.id as examTaskDetailId,
|
|
|
|
+ epp.id as printPlanId,
|
|
epp.name as printPlanName,
|
|
epp.name as printPlanName,
|
|
- IFNULL(etd.draw_count,0) as drawCount,
|
|
|
|
- IFNULL(epp.backup_count,0) as backupCount,
|
|
|
|
|
|
+ IFNULL(etd.draw_count, 0) as drawCount,
|
|
(
|
|
(
|
|
select
|
|
select
|
|
count(1)
|
|
count(1)
|
|
@@ -84,47 +126,52 @@
|
|
exam_student es
|
|
exam_student es
|
|
where
|
|
where
|
|
es.exam_detail_course_id = edc.id
|
|
es.exam_detail_course_id = edc.id
|
|
- and es.clazz_id = tcs.clazz_id
|
|
|
|
|
|
+ and es.clazz_id = tcst.clazz_id
|
|
and es.school_id = #{schoolId}) as examStudentCount,
|
|
and es.school_id = #{schoolId}) as examStudentCount,
|
|
|
|
+ IFNULL(epp.backup_count, 0) as backupCount,
|
|
case
|
|
case
|
|
- when epp.status = 'PRINT_FINISH' or epp.status = 'END' then 'FINISH'
|
|
|
|
- else 'UN_FINISH'
|
|
|
|
- end status
|
|
|
|
|
|
+ when epp.status = 'PRINT_FINISH'
|
|
|
|
+ or epp.status = 'END' then 'FINISH'
|
|
|
|
+ else 'UN_FINISH'
|
|
|
|
+ end status
|
|
from
|
|
from
|
|
- t_c_statistics tcs
|
|
|
|
|
|
+ t_c_statistics_temp tcst
|
|
join exam_task et on
|
|
join exam_task et on
|
|
- et.course_code = tcs.course_code
|
|
|
|
- and et.teaching_room_id = tcs.teaching_room_id
|
|
|
|
|
|
+ et.course_code = tcst.course_code
|
|
|
|
+ and et.teaching_room_id = tcst.teaching_room_id
|
|
join exam_task_detail etd on
|
|
join exam_task_detail etd on
|
|
- etd.exam_task_id = et.id
|
|
|
|
|
|
+ etd.exam_task_id = et.id
|
|
join exam_detail_course edc on
|
|
join exam_detail_course edc on
|
|
- edc.course_code = tcs.course_code
|
|
|
|
|
|
+ edc.course_code = tcst.course_code
|
|
and edc.paper_number = et.paper_number
|
|
and edc.paper_number = et.paper_number
|
|
and edc.school_id = et.school_id
|
|
and edc.school_id = et.school_id
|
|
join exam_detail ed on
|
|
join exam_detail ed on
|
|
- ed.id = edc.exam_detail_id
|
|
|
|
|
|
+ ed.id = edc.exam_detail_id
|
|
join exam_print_plan epp on
|
|
join exam_print_plan epp on
|
|
- epp.id = ed.print_plan_id
|
|
|
|
|
|
+ epp.id = ed.print_plan_id
|
|
where
|
|
where
|
|
- et.enable = true
|
|
|
|
|
|
+ et.enable = true
|
|
and etd.enable = true
|
|
and etd.enable = true
|
|
- and et.school_id = #{schoolId}) t
|
|
|
|
- <where>
|
|
|
|
- <if test="collegeId != null and collegeId != ''">
|
|
|
|
- and t.collegeId = #{collegeId}
|
|
|
|
- </if>
|
|
|
|
- <if test="teachingRoomId != null and teachingRoomId != ''">
|
|
|
|
- and t.teachingRoomId = #{teachingRoomId}
|
|
|
|
- </if>
|
|
|
|
- <if test="status != null and status != ''">
|
|
|
|
- and t.status = #{status}
|
|
|
|
- </if>
|
|
|
|
- <if test="courseName != null and courseName != ''">
|
|
|
|
- and t.courseName like concat('%',#{courseName},'%')
|
|
|
|
- </if>
|
|
|
|
- <if test="teacherName != null and teacherName != ''">
|
|
|
|
- and t.teacherName like concat('%',#{teacherName},'%')
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
|
|
+ and et.school_id = #{schoolId}
|
|
|
|
+ and tcst.batch_no = #{batchNo}) t
|
|
|
|
+ group by
|
|
|
|
+ t.collegeId,
|
|
|
|
+ t.collegeName,
|
|
|
|
+ t.courseName,
|
|
|
|
+ t.courseCode,
|
|
|
|
+ t.teachingRoomId,
|
|
|
|
+ t.teachingRoomName,
|
|
|
|
+ t.teacherName,
|
|
|
|
+ t.clazzId,
|
|
|
|
+ t.clazzName,
|
|
|
|
+ t.paperNumber,
|
|
|
|
+ t.printPlanId,
|
|
|
|
+ t.printPlanName,
|
|
|
|
+ t.status,
|
|
|
|
+ t.drawCount,
|
|
|
|
+ t.batchNo
|
|
|
|
+ order by
|
|
|
|
+ t.printPlanId,
|
|
|
|
+ t.clazzId
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|