|
@@ -1318,90 +1318,98 @@
|
|
|
and edc.exam_detail_id = ed.id
|
|
|
</sql>
|
|
|
|
|
|
- <select id="statementCountList" resultType="com.qmth.distributed.print.business.bean.result.statistics.StatementResult">
|
|
|
+ <sql id="statementCountCommon">
|
|
|
select
|
|
|
- t.*,
|
|
|
- ec.type as cardType,
|
|
|
- if(t.unGenerated = 0 and t.unPrinted = 0,'FINISH','UN_FINISH') as finishStatus
|
|
|
+ t.*,
|
|
|
+ ec.type as cardType,
|
|
|
+ if(t.unGenerated = 0 and t.unPrinted = 0,'FINISH','UN_FINISH') as finishStatus
|
|
|
from
|
|
|
- (
|
|
|
- select distinct
|
|
|
- et.id,
|
|
|
- GROUP_CONCAT(distinct bc.name, '(', bc.code, ')') as courseNameCode,
|
|
|
- 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="statementStatusCount" />)) as totalExamination,
|
|
|
- (<include refid="statementStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING', 'FINISH'))) as generate,
|
|
|
- (<include refid="statementStatusCount" /> and ed.status in ('NEW', 'CREATING'))) as unGenerated,
|
|
|
- (<include refid="statementStatusCount" /> and ed.status = 'FINISH')) as printed,
|
|
|
- (<include refid="statementStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING'))) as unPrinted,
|
|
|
- (<include refid="statementStatusCount" /> and ed.status = 'CANCEL')) as invalid,
|
|
|
- (<include refid="statementStatusCount" /> and ed.status = 'REJECT')) as reject
|
|
|
- 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
|
|
|
- left join exam_detail_course edc on edc.course_id = et.course_id
|
|
|
- left join exam_detail ed on ed.id = edc.exam_detail_id
|
|
|
- left join sys_org so on so.id = bc.teaching_room_id
|
|
|
- left join t_f_flow_approve tffa on tffa.flow_id = et.flow_id
|
|
|
- left join basic_exam be on be.id = et.exam_id and be.enable = true
|
|
|
- left join basic_semester bs on bs.id = be.semester_id and bs.enable = true
|
|
|
- <where> 1 = 1
|
|
|
- and (et.status = 'SUBMIT' and (et.flow_id is null or (et.flow_id is not null and tffa.status = 'FINISH')))
|
|
|
- <if test="schoolId != null and schoolId != ''">
|
|
|
- AND et.school_id = #{schoolId}
|
|
|
- </if>
|
|
|
- <if test="semesterId != null and semesterId != ''">
|
|
|
- AND be.semester_id = #{semesterId}
|
|
|
- </if>
|
|
|
- <if test="examId != null and examId != ''">
|
|
|
- AND be.id = #{examId}
|
|
|
- </if>
|
|
|
- <if test="printPlanId != null and printPlanId != ''">
|
|
|
- AND ed.print_plan_id = #{printPlanId}
|
|
|
- </if>
|
|
|
- <if test="collegeId != null and collegeId != ''">
|
|
|
- AND so.id = #{collegeId}
|
|
|
- </if>
|
|
|
- <if test="courseId != null and courseId != ''">
|
|
|
- AND bc.id = #{courseId}
|
|
|
- </if>
|
|
|
- <if test="paperNumber != null and paperNumber != ''">
|
|
|
- AND et.paper_number = #{paperNumber}
|
|
|
- </if>
|
|
|
- <if test="dpr != null">
|
|
|
- <if test="dpr.requestUserId != null">
|
|
|
- AND et.user_id = #{dpr.requestUserId}
|
|
|
- </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 = et.course_id)
|
|
|
- </if>
|
|
|
- <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
|
|
|
- AND bc.teaching_room_id IN
|
|
|
- <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- group by et.id,bc.code,bc.name,et.paper_number) t
|
|
|
- left join exam_card ec on ec.id = t.cardId
|
|
|
- <where>
|
|
|
- <if test="cardType != null and cardType != ''">
|
|
|
- AND ec.type = #{cardType}
|
|
|
- </if>
|
|
|
- <if test="finishStatus != null and finishStatus != ''">
|
|
|
- <choose>
|
|
|
- <when test="finishStatus == 'FINISH'">
|
|
|
- and (t.unGenerated = and or t.unPrinted = 0)
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- and (t.unGenerated <![CDATA[ > ]]> 0 or t.unPrinted <![CDATA[ > ]]> 0)
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- order by t.paperNumber desc
|
|
|
+ (
|
|
|
+ select distinct
|
|
|
+ et.id,
|
|
|
+ GROUP_CONCAT(distinct bc.name, '(', bc.code, ')') as courseNameCode,
|
|
|
+ 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="statementStatusCount" />)) as totalExamination,
|
|
|
+ (<include refid="statementStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING', 'FINISH'))) as generate,
|
|
|
+ (<include refid="statementStatusCount" /> and ed.status in ('NEW', 'CREATING'))) as unGenerated,
|
|
|
+ (<include refid="statementStatusCount" /> and ed.status = 'FINISH')) as printed,
|
|
|
+ (<include refid="statementStatusCount" /> and ed.status in ('READY', 'WAITING', 'PRINTING'))) as unPrinted,
|
|
|
+ (<include refid="statementStatusCount" /> and ed.status = 'CANCEL')) as invalid,
|
|
|
+ (<include refid="statementStatusCount" /> and ed.status = 'REJECT')) as reject
|
|
|
+ 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
|
|
|
+ left join exam_detail_course edc on edc.course_id = et.course_id
|
|
|
+ left join exam_detail ed on ed.id = edc.exam_detail_id
|
|
|
+ left join sys_org so on so.id = bc.teaching_room_id
|
|
|
+ left join t_f_flow_approve tffa on tffa.flow_id = et.flow_id
|
|
|
+ left join basic_exam be on be.id = et.exam_id and be.enable = true
|
|
|
+ left join basic_semester bs on bs.id = be.semester_id and bs.enable = true
|
|
|
+ <where> 1 = 1
|
|
|
+ and (et.status = 'SUBMIT' and (et.flow_id is null or (et.flow_id is not null and tffa.status = 'FINISH')))
|
|
|
+ <if test="schoolId != null and schoolId != ''">
|
|
|
+ AND et.school_id = #{schoolId}
|
|
|
+ </if>
|
|
|
+ <if test="semesterId != null and semesterId != ''">
|
|
|
+ AND be.semester_id = #{semesterId}
|
|
|
+ </if>
|
|
|
+ <if test="examId != null and examId != ''">
|
|
|
+ AND be.id = #{examId}
|
|
|
+ </if>
|
|
|
+ <if test="printPlanId != null and printPlanId != ''">
|
|
|
+ AND ed.print_plan_id = #{printPlanId}
|
|
|
+ </if>
|
|
|
+ <if test="collegeId != null and collegeId != ''">
|
|
|
+ AND so.id = #{collegeId}
|
|
|
+ </if>
|
|
|
+ <if test="courseId != null and courseId != ''">
|
|
|
+ AND bc.id = #{courseId}
|
|
|
+ </if>
|
|
|
+ <if test="paperNumber != null and paperNumber != ''">
|
|
|
+ AND et.paper_number = #{paperNumber}
|
|
|
+ </if>
|
|
|
+ <if test="dpr != null">
|
|
|
+ <if test="dpr.requestUserId != null">
|
|
|
+ AND et.user_id = #{dpr.requestUserId}
|
|
|
+ </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 = et.course_id)
|
|
|
+ </if>
|
|
|
+ <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
|
|
|
+ AND bc.teaching_room_id IN
|
|
|
+ <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by et.id,bc.code,bc.name,et.paper_number) t
|
|
|
+ left join exam_card ec on ec.id = t.cardId
|
|
|
+ <where>
|
|
|
+ <if test="cardType != null and cardType != ''">
|
|
|
+ AND ec.type = #{cardType}
|
|
|
+ </if>
|
|
|
+ <if test="finishStatus != null and finishStatus != ''">
|
|
|
+ <choose>
|
|
|
+ <when test="finishStatus == 'FINISH'">
|
|
|
+ and (t.unGenerated = and or t.unPrinted = 0)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and (t.unGenerated <![CDATA[ > ]]> 0 or t.unPrinted <![CDATA[ > ]]> 0)
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by t.paperNumber desc
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="statementCountList" resultType="com.qmth.distributed.print.business.bean.result.statistics.StatementResult">
|
|
|
+ <include refid="statementCountCommon" />
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="statementCountListExport" resultType="com.qmth.distributed.print.business.bean.result.statistics.StatementResult">
|
|
|
+ <include refid="statementCountCommon" />
|
|
|
</select>
|
|
|
</mapper>
|