|
@@ -213,8 +213,7 @@
|
|
ifnull(sum(ifnull(b.pages_a3, 0)), 0)/2 pagesA3,
|
|
ifnull(sum(ifnull(b.pages_a3, 0)), 0)/2 pagesA3,
|
|
ifnull(sum(ifnull(b.pages_a4, 0)), 0) /2 pagesA4,
|
|
ifnull(sum(ifnull(b.pages_a4, 0)), 0) /2 pagesA4,
|
|
ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.pages_a3, 0) end),0)/2 pagesA3Left,
|
|
ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.pages_a3, 0) end),0)/2 pagesA3Left,
|
|
- ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.pages_a4, 0) end),0)/2 pagesA4Left,
|
|
|
|
- ifnull(c.paperCount, 0) paperCount
|
|
|
|
|
|
+ ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.pages_a4, 0) end),0)/2 pagesA4Left
|
|
FROM
|
|
FROM
|
|
exam_print_plan a
|
|
exam_print_plan a
|
|
JOIN
|
|
JOIN
|
|
@@ -222,7 +221,6 @@
|
|
JOIN
|
|
JOIN
|
|
(SELECT
|
|
(SELECT
|
|
exam_detail_id,
|
|
exam_detail_id,
|
|
- count(distinct a.paper_number) paperCount,
|
|
|
|
GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) courseNameCode,
|
|
GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) courseNameCode,
|
|
GROUP_CONCAT(a.paper_number) paperNumber,
|
|
GROUP_CONCAT(a.paper_number) paperNumber,
|
|
GROUP_CONCAT(IFNULL(a.paper_pages_a3, 0) + IFNULL(a.card_pages_a3, 0)) singlePagesA3,
|
|
GROUP_CONCAT(IFNULL(a.paper_pages_a3, 0) + IFNULL(a.card_pages_a3, 0)) singlePagesA3,
|
|
@@ -300,5 +298,144 @@
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
+ <select id="listClientPrintStatistics"
|
|
|
|
+ resultType="com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsDto">
|
|
|
|
+ SELECT
|
|
|
|
+ a.id printPlanId,
|
|
|
|
+ a.name printPlanName,
|
|
|
|
+ b.exam_start_time examStartTime,
|
|
|
|
+ b.exam_end_time examEndTime,
|
|
|
|
+ b.exam_place examPlace,
|
|
|
|
+ COUNT(b.package_code) packageCount,
|
|
|
|
+ GROUP_CONCAT(c.course_name_code) courseNameCode,
|
|
|
|
+ GROUP_CONCAT(c.paper_number) paperNumber,
|
|
|
|
+ SUM(b.total_subjects) totalSubjects,
|
|
|
|
+ SUM(CASE b.status
|
|
|
|
+ WHEN 'FINISH' THEN 0
|
|
|
|
+ ELSE b.total_subjects
|
|
|
|
+ END) totalSubjectsLeft,
|
|
|
|
+ SUM(CASE b.status
|
|
|
|
+ WHEN 'FINISH' THEN 0
|
|
|
|
+ ELSE b.pages_a3
|
|
|
|
+ END) pagesA3Left,
|
|
|
|
+ SUM(CASE b.status
|
|
|
|
+ WHEN 'FINISH' THEN 0
|
|
|
|
+ ELSE b.pages_a4
|
|
|
|
+ END) pagesA4Left,
|
|
|
|
+ ROUND(AVG(IFNULL(b.print_progress, 0)), 0) progress
|
|
|
|
+ FROM
|
|
|
|
+ exam_print_plan a
|
|
|
|
+ JOIN
|
|
|
|
+ exam_detail b ON a.id = b.print_plan_id
|
|
|
|
+ JOIN
|
|
|
|
+ (SELECT
|
|
|
|
+ exam_detail_id,
|
|
|
|
+ GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) course_name_code,
|
|
|
|
+ GROUP_CONCAT(a.paper_number) paper_number
|
|
|
|
+ FROM
|
|
|
|
+ exam_detail_course a
|
|
|
|
+ <where>
|
|
|
|
+ <if test="courseCode != null and courseCode != ''">
|
|
|
|
+ and a.course_code = #{courseCode}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="paperNumber != null and paperNumber != ''">
|
|
|
|
+ and a.paper_number = #{paperNumber}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY exam_detail_id) c ON b.id = c.exam_detail_id
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ sys_user d ON a.create_id = d.id
|
|
|
|
+ <where>
|
|
|
|
+ and a.school_id = #{schoolId}
|
|
|
|
+ AND b.status not IN
|
|
|
|
+ <foreach collection="examDetailStatus" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ <if test="printPlanId != null and printPlanId != ''">
|
|
|
|
+ and a.id = #{printPlanId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="examPlace != null and examPlace != ''">
|
|
|
|
+ and b.exam_place = #{examPlace}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="examStartTime != null and examStartTime != ''">
|
|
|
|
+ and b.exam_start_time > #{examStartTime}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="examEndTime != null and examEndTime != ''">
|
|
|
|
+ and b.exam_end_time < #{examEndTime}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="orgIds != null">
|
|
|
|
+ AND d.org_id IN
|
|
|
|
+ <foreach collection="orgIds" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY a.id , a.name , b.exam_start_time , b.exam_end_time , b.exam_place
|
|
|
|
+ </select>
|
|
|
|
+ <select id="clientStatisticsTotalData"
|
|
|
|
+ resultType="com.qmth.distributed.print.business.bean.dto.ClientPrintStatisticsTotalDto">
|
|
|
|
+ SELECT
|
|
|
|
+ COUNT(b.package_code) packageCount,
|
|
|
|
+ GROUP_CONCAT(c.paper_type) paperNumberAndType,
|
|
|
|
+ SUM(b.total_subjects) totalSubjects,
|
|
|
|
+ SUM(ifnull(b.pages_a3,0))/2 pagesA3,
|
|
|
|
+ SUM(ifnull(b.pages_a4,0))/2 pagesA4,
|
|
|
|
+ SUM(CASE b.status
|
|
|
|
+ WHEN 'FINISH' THEN 0
|
|
|
|
+ ELSE ifnull(b.pages_a3, 0)
|
|
|
|
+ END)/2 pagesA3Left,
|
|
|
|
+ SUM(CASE b.status
|
|
|
|
+ WHEN 'FINISH' THEN 0
|
|
|
|
+ ELSE ifnull(b.pages_a4,0)
|
|
|
|
+ END)/2 pagesA4Left
|
|
|
|
+ FROM
|
|
|
|
+ exam_print_plan a
|
|
|
|
+ JOIN
|
|
|
|
+ exam_detail b ON a.id = b.print_plan_id
|
|
|
|
+ JOIN
|
|
|
|
+ (SELECT
|
|
|
|
+ exam_detail_id,
|
|
|
|
+ GROUP_CONCAT(CONCAT(a.paper_number, ':', a.paper_type)) paper_type,
|
|
|
|
+ GROUP_CONCAT(CONCAT(a.course_name, '(', a.course_code, ')')) course_name_code,
|
|
|
|
+ GROUP_CONCAT(a.paper_number) paper_number
|
|
|
|
+ FROM
|
|
|
|
+ exam_detail_course a
|
|
|
|
+ <where>
|
|
|
|
+ <if test="courseCode != null and courseCode != ''">
|
|
|
|
+ and a.course_code = #{courseCode}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="paperNumber != null and paperNumber != ''">
|
|
|
|
+ and a.paper_number = #{paperNumber}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY exam_detail_id) c ON b.id = c.exam_detail_id
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ sys_user d ON a.create_id = d.id
|
|
|
|
+ <where>
|
|
|
|
+ and a.school_id = #{schoolId}
|
|
|
|
+ AND b.status not IN
|
|
|
|
+ <foreach collection="examDetailStatus" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ <if test="printPlanId != null and printPlanId != ''">
|
|
|
|
+ and a.id = #{printPlanId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="examPlace != null and examPlace != ''">
|
|
|
|
+ and b.exam_place = #{examPlace}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="examStartTime != null and examStartTime != ''">
|
|
|
|
+ and b.exam_start_time > #{examStartTime}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="examEndTime != null and examEndTime != ''">
|
|
|
|
+ and b.exam_end_time < #{examEndTime}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="orgIds != null">
|
|
|
|
+ AND d.org_id IN
|
|
|
|
+ <foreach collection="orgIds" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|