123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!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.ExamDetailMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.qmth.distributed.print.business.entity.ExamDetail">
- <result column="id" property="id" />
- <result column="school_id" property="schoolId" />
- <result column="print_plan_id" property="printPlanId" />
- <result column="print_plan_name" property="printPlanName" />
- <result column="exam_start_time" property="examStartTime" />
- <result column="exam_end_time" property="examEndTime" />
- <result column="exam_place" property="examPlace" />
- <result column="total_subjects" property="totalSubjects" />
- <result column="exam_room" property="examRoom" />
- <result column="print_progress" property="printProgress" />
- <result column="print_user" property="printUser" />
- <result column="package_code" property="packageCode" />
- <result column="create_id" property="createId" />
- <result column="create_time" property="createTime" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id,
- school_id, print_plan_id, print_plan_name, exam_name, exam_start_time, exam_end_time, exam_place, total_subjects, exam_room, print_progress, print_user, package_code, create_id, create_time
- </sql>
- <select id="listPrintTask" resultType="com.qmth.distributed.print.business.bean.dto.PrintTaskDto">
- SELECT
- b.id examDetailId,
- b.package_code packageCode,
- a.id printPlanId,
- a.name printPlanName,
- b.exam_start_time examStartTime,
- b.exam_end_time examEndTime,
- c.courseNameCode,
- c.paperNumber,
- b.exam_place examPlace,
- b.exam_room examRoom,
- b.total_subjects totalSubjects,
- ifnull(b.paper_pages, 0) paperPages,
- ifnull(b.card_pages, 0) cardPages,
- ifnull(b.pages_a4, 0) pagesA4,
- c.singlePagesA3,
- b.status,
- b.validate,
- b.print_start_time printStartTime,
- b.print_end_time printEndTime,
- b.normal,
- b.print_house_id as printHouseId,
- b.task_id taskId,
- e.name as printHouseName,
- e.code as printHouseCode,
- a.semester_id as semesterId,
- a.semester_name as semesterName,
- a.exam_id as examId,
- a.exam_name as examName
- FROM
- (select epp.id, epp.exam_id, epp.name, be.name exam_name, bs.id semester_id, bs.name semester_name
- from exam_print_plan epp
- LEFT JOIN
- basic_exam be ON be.id = epp.exam_id
- LEFT JOIN
- basic_semester bs ON bs.id = be.semester_id
- <where>
- <if test="schoolId != null">
- and epp.school_id = #{schoolId}
- </if>
- <if test="semesterId != null">
- and bs.id = #{semesterId}
- </if>
- <if test="examId != null">
- and be.id = #{examId}
- </if>
- <if test="printPlanId != null">
- and epp.id = #{printPlanId}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND epp.create_id = #{dpr.requestUserId}
- </if>
- <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
- AND epp.org_id IN
- <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- </where>) a
- JOIN
- (select * from exam_detail
- <where>
- <if test="status != null and status != ''">
- and status = #{status}
- </if>
- <if test="examPlace != null and examPlace != ''">
- and exam_place = #{examPlace}
- </if>
- <if test="examRoom != null and examRoom != ''">
- and exam_room = #{examRoom}
- </if>
- <if test="examStartTime != null and examStartTime != ''">
- and exam_start_time > #{examStartTime}
- </if>
- <if test="examEndTime != null and examEndTime != ''">
- and exam_end_time < #{examEndTime}
- </if>
- <if test="printStartTime != null and printStartTime != ''">
- and print_start_time > #{printStartTime}
- </if>
- <if test="printEndTime != null and printEndTime != ''">
- and print_start_time < #{printEndTime}
- </if>
- <if test="printHouseId != null and printHouseId != ''">
- and print_house_id = #{printHouseId}
- </if>
- </where>) b ON a.id = b.print_plan_id
- JOIN
- (SELECT
- exam_detail_id,
- GROUP_CONCAT(CONCAT(course_name, '(', course_code, ')')) courseNameCode,
- GROUP_CONCAT(paper_number) paperNumber,
- GROUP_CONCAT(ifnull(paper_pages_a3, 0) + ifnull(card_pages_a3, 0)) singlePagesA3
- FROM
- exam_detail_course
- <where>
- <if test="courseCode != null and courseCode != ''">
- and course_code = #{courseCode}
- </if>
- <if test="paperNumber != null and paperNumber != ''">
- and paper_number = #{paperNumber}
- </if>
- </where>
- GROUP BY exam_detail_id) c ON b.id = c.exam_detail_id
- LEFT JOIN
- sys_org e ON b.print_house_id = e.id
- ORDER BY b.id desc
- </select>
- <select id="findBriefPage" resultType="com.qmth.distributed.print.business.bean.result.ExaminationResult">
- SELECT
- det.id AS id,
- MAX(bs.id) AS semesterId,
- MAX(bs.name) AS semesterName,
- MAX(be.id) AS examId,
- MAX(be.name) AS examName,
- MAX(det.school_id) AS schoolId,
- MAX(det.print_plan_id) AS printPlanId,
- MAX(det.print_plan_name) AS printPlanName,
- MAX(det.exam_start_time) AS examStartTime,
- MAX(det.exam_end_time) AS examEndTime,
- MAX(det.exam_place) AS examPlace,
- MAX(det.total_subjects) AS totalSubjects,
- MAX(det.exam_room) AS examRoom,
- MAX(det.package_code) AS packageCode,
- MAX(det.create_id) AS createId,
- MAX(det.create_time) AS createTime,
- GROUP_CONCAT(cou.id) AS examDetailCourseIds,
- GROUP_CONCAT(CONCAT(cou.course_name, '(', cou.course_code, ')')) AS courseNameCode,
- GROUP_CONCAT(cou.course_code) AS courseCodes,
- GROUP_CONCAT(cou.paper_number) AS paperNumber
- FROM
- exam_detail det
- INNER JOIN
- exam_detail_course cou ON det.id = cou.exam_detail_id
- LEFT JOIN
- basic_exam be on be.id = det.exam_id
- LEFT JOIN
- basic_semester bs on bs.id = be.semester_id
- <where>
- and be.enable = true
- <if test="schoolId != null and schoolId > 0">
- AND det.school_id = #{schoolId}
- </if>
- <if test="printPlanIdList != null and printPlanIdList != '' and printPlanIdList.size() > 0">
- AND det.print_plan_id IN
- <foreach collection="printPlanIdList" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="examPlace != null and examPlace != ''">
- AND det.exam_place = #{examPlace}
- </if>
- <if test="examRoom != null and examRoom != ''">
- AND det.exam_room = #{examRoom}
- </if>
- <if test="packageCode != null and packageCode != ''">
- AND det.package_code = #{packageCode}
- </if>
- <if test="startDate != null and startDate > 0">
- AND det.exam_start_time >= #{startDate}
- </if>
- <if test="endDate != null and endDate > 0">
- AND #{endDate} >= det.exam_end_time
- </if>
- <if test="semesterId != null and semesterId != ''">
- AND bs.id = #{semesterId}
- </if>
- <if test="examId != null and examId != ''">
- AND be.id = #{examId}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND det.create_id = #{dpr.requestUserId}
- </if>
- <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
- AND det.org_id IN
- <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- </where>
- GROUP BY det.id
- <trim prefix="having" suffixOverrides="and">
- <if test="courseCode != null and courseCode != ''">
- find_in_set(#{courseCode},courseCodes) and
- </if>
- <if test="paperNumber != null and paperNumber != ''">
- find_in_set(#{paperNumber},paperNumber) and
- </if>
- </trim>
- order by det.id desc
- </select>
- <select id="findDetailPage"
- resultType="com.qmth.distributed.print.business.bean.result.ExaminationDetailResult">
- SELECT
- stu.id AS id,
- stu.exam_detail_course_id,
- stu.student_name AS studentName,
- stu.student_code AS studentCode,
- stu.ticket_number AS ticketNumber,
- stu.site_number AS siteNumber,
- stu.create_id AS createId,
- stu.create_time AS createTime,
- a.exam_id AS examId,
- a.exam_name AS examName,
- CONCAT(a.course_name,
- '(',
- a.course_code,
- ')') AS courseNameCode,
- a.paper_number AS paperNumber,
- a.print_plan_id AS printPlanId,
- a.print_plan_name AS printPlanName,
- a.exam_start_time AS examStartTime,
- a.exam_end_time AS examEndTime,
- a.exam_place AS examPlace,
- a.exam_room AS examRoom
- FROM
- (select be.id exam_id,
- be.name exam_name,
- edc.id exam_detail_course_id,
- edc.course_code,
- edc.course_name,
- edc.paper_number,
- ed.print_plan_id,
- ed.print_plan_name,
- ed.exam_start_time,
- ed.exam_end_time,
- ed.exam_place,
- ed.exam_room
- from exam_detail ed
- JOIN
- exam_detail_course edc on ed.id = edc.exam_detail_id
- LEFT JOIN
- sys_user b on ed.create_id = b.id
- LEFT JOIN
- basic_exam be ON be.id = ed.exam_id
- LEFT JOIN
- basic_semester bs ON bs.id = be.semester_id
- <where>
- and be.enable = true
- <if test="schoolId != null">
- AND ed.school_id = #{schoolId}
- </if>
- <if test="semesterId != null">
- and bs.id = #{semesterId}
- </if>
- <if test="examId != null">
- and be.id = #{examId}
- </if>
- <if test="printPlanIdList != null and printPlanIdList != '' and printPlanIdList.size() > 0">
- AND ed.print_plan_id IN
- <foreach collection="printPlanIdList" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="courseCode != null and courseCode != ''">
- AND edc.course_code = #{courseCode}
- </if>
- <if test="paperNumber != null and paperNumber != ''">
- AND edc.paper_number = #{paperNumber}
- </if>
- <if test="examPlace != null and examPlace != ''">
- AND ed.exam_place = #{examPlace}
- </if>
- <if test="examRoom != null and examRoom != ''">
- AND ed.exam_room = #{examRoom}
- </if>
- <if test="startDate != null and startDate > 0">
- AND ed.exam_start_time >= #{startDate}
- </if>
- <if test="endDate != null and endDate > 0">
- AND ed.exam_end_time <= #{endDate}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND b.id = #{dpr.requestUserId}
- </if>
- <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
- AND b.org_id IN
- <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- </where>) a
- join
- exam_student stu ON a.exam_detail_course_id = stu.exam_detail_course_id
- <where>
- <if test="studentParams != null and studentParams != ''">
- AND (stu.ticket_number LIKE CONCAT('%',#{studentParams},'%') OR stu.student_code LIKE CONCAT('%',#{studentParams},'%') OR stu.student_name LIKE CONCAT('%',#{studentParams},'%'))
- </if>
- </where>
- order by stu.exam_detail_course_id desc, stu.id desc
- </select>
- <select id="findDetailPageById"
- resultType="com.qmth.distributed.print.business.bean.result.ExaminationDetailResult">
- SELECT
- stu.id AS id,
- stu.exam_detail_course_id,
- stu.student_name AS studentName,
- stu.student_code AS studentCode,
- stu.ticket_number AS ticketNumber,
- stu.site_number AS siteNumber,
- stu.create_id AS createId,
- stu.create_time AS createTime,
- CONCAT(cou.course_name,
- '(',
- cou.course_code,
- ')') AS courseNameCode,
- cou.paper_number AS paperNumber,
- det.print_plan_id AS printPlanId,
- det.print_plan_name AS printPlanName,
- det.exam_place AS examPlace,
- det.exam_room AS examRoom,
- bs.id AS semesterId,
- bs.name AS semesterName,
- be.id AS examId,
- be.name AS examName,
- stu.can_delete canDelete
- FROM
- exam_student stu
- INNER JOIN
- exam_detail_course cou ON stu.exam_detail_course_id = cou.id
- AND stu.school_id = cou.school_id
- INNER JOIN
- exam_detail det ON cou.exam_detail_id = det.id
- AND stu.school_id = det.school_id
- LEFT JOIN
- exam_print_plan epp ON det.print_plan_id = epp.id
- LEFT JOIN
- basic_exam be ON be.id = epp.exam_id
- LEFT JOIN
- basic_semester bs ON bs.id = be.semester_id
- <where>
- <if test="examDetailId != null">
- AND det.id = #{examDetailId}
- </if>
- <if test="param != null and param != ''">
- AND (stu.student_name like concat('%', #{param}) or stu.student_code like concat('%', #{param}))
- </if>
- </where>
- order by stu.can_delete desc, stu.student_code
- </select>
- <select id="taskTotalData" resultType="com.qmth.distributed.print.business.bean.dto.PrintTaskTotalDto">
- SELECT
- ifnull(count(b.package_code), 0) packageCount,
- ifnull(sum(b.total_subjects), 0) totalSubjects,
- ifnull(sum(ifnull(b.paper_pages, 0)), 0)/2 paperPages,
- ifnull(sum(ifnull(b.card_pages, 0)), 0)/2 cardPages,
- ifnull(sum(ifnull(b.pages_a4, 0)), 0) /2 pagesA4,
- ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.paper_pages, 0) end),0)/2 paperPagesLeft,
- ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.card_pages, 0) end),0)/2 cardPagesLeft,
- ifnull(sum(case b.status when 'FINISH' then 0 else ifnull(b.pages_a4, 0) end),0)/2 pagesA4Left
- FROM
- (select epp.id from exam_print_plan epp
- LEFT JOIN
- basic_exam be ON be.id = epp.exam_id
- LEFT JOIN
- basic_semester bs ON bs.id = be.semester_id
- <where>
- and be.enable = true
- <if test="schoolId != null">
- and epp.school_id = #{schoolId}
- </if>
- <if test="semesterId != null">
- and bs.id = #{semesterId}
- </if>
- <if test="examId != null">
- and be.id = #{examId}
- </if>
- <if test="printPlanId != null">
- and epp.id = #{printPlanId}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND epp.create_id = #{dpr.requestUserId}
- </if>
- <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
- AND epp.org_id IN
- <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- </where>) a
- JOIN
- (select * from exam_detail ed
- <where>
- <if test="status != null and status != ''">
- and ed.status = #{status}
- </if>
- <if test="examPlace != null and examPlace != ''">
- and ed.exam_place = #{examPlace}
- </if>
- <if test="examRoom != null and examRoom != ''">
- and ed.exam_room = #{examRoom}
- </if>
- <if test="examStartTime != null and examStartTime != ''">
- and ed.exam_start_time > #{examStartTime}
- </if>
- <if test="examEndTime != null and examEndTime != ''">
- and ed.exam_end_time < #{examEndTime}
- </if>
- <if test="printStartTime != null and printStartTime != ''">
- and ed.print_start_time > #{printStartTime}
- </if>
- <if test="printEndTime != null and printEndTime != ''">
- and ed.print_start_time < #{printEndTime}
- </if>
- <if test="printHouseId != null and printHouseId != ''">
- and ed.print_house_id = #{printHouseId}
- </if>
- <if test="courseCode != null or paperNumber != null">
- and exists (select 1 from exam_detail_course edc where ed.id = edc.exam_detail_id
- <if test="courseCode != null">
- and edc.course_code = #{courseCode}
- </if>
- <if test="paperNumber != null">
- and edc.paper_number = #{paperNumber}
- </if>
- )
- </if>
- </where>) b ON a.id = b.print_plan_id
- </select>
- <select id="listStudentByExamDetailCourseId" resultType="java.util.Map">
- SELECT
- b.course_code courseCode,
- b.course_name courseName,
- b.paper_number paperNumber,
- c.student_name studentName,
- c.student_code studentCode,
- c.attachment_id attachmentId,
- c.paper_type paperType
- FROM
- exam_detail a
- JOIN
- exam_detail_course b ON a.id = b.exam_detail_id
- JOIN
- exam_student c ON b.id = c.exam_detail_course_id
- WHERE
- b.id = #{examDetailCourseId}
- <if test="type == 'ONE'">
- and c.student_code = #{studentCode}
- </if>
- <if test="type == 'MORE'">
- and c.student_code >= #{studentCode}
- </if>
- </select>
- <select id="selectPaperCount" resultType="java.lang.Integer">
- SELECT
- count(distinct c.paper_number, c.paper_type)
- FROM
- exam_print_plan a
- JOIN
- exam_detail b ON a.id = b.print_plan_id
- JOIN
- exam_detail_course c ON b.id = c.exam_detail_id
- JOIN
- sys_user d ON a.create_id = d.id
- JOIN
- basic_exam e ON a.exam_id = e.id
- <where>
- and c.paper_type is not null and e.enable = true
- <if test="schoolId != null and schoolId != ''">
- and a.school_id = #{schoolId}
- </if>
- <if test="semesterId != null and semesterId != ''">
- and e.semester_id = #{semesterId}
- </if>
- <if test="examId != null and examId != ''">
- and e.id = #{examId}
- </if>
- <if test="printPlanId != null and printPlanId != ''">
- and a.id = #{printPlanId}
- </if>
- <if test="status != null and status != ''">
- and b.status = #{status}
- </if>
- <if test="courseCode != null and courseCode != ''">
- and c.course_code = #{courseCode}
- </if>
- <if test="paperNumber != null and paperNumber != ''">
- and c.paper_number = #{paperNumber}
- </if>
- <if test="examPlace != null and examPlace != ''">
- and b.exam_place = #{examPlace}
- </if>
- <if test="examRoom != null and examRoom != ''">
- and b.exam_room = #{examRoom}
- </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="printHouseId != null and printHouseId != ''">
- and b.print_house_id = #{printHouseId}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND a.create_id = #{dpr.requestUserId}
- </if>
- <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
- AND a.org_id IN
- <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- </where>
- </select>
- <select id="findPdfDownload" resultType="com.qmth.distributed.print.business.bean.dto.ExamDetailPdfDownloadDto">
- select
- ed.*,
- bs.name as semesterName,
- be.name as examName,
- GROUP_CONCAT(CONCAT(edc.course_name, '(', edc.course_code, ')')) as courseNameCode,
- GROUP_CONCAT(edc.paper_number) paperNumber
- from
- exam_detail ed
- join exam_print_plan epp on
- epp.id = ed.print_plan_id
- join basic_exam be on
- be.id = epp.exam_id
- join basic_semester bs on
- bs.id = be.semester_id
- join exam_detail_course edc on
- edc.exam_detail_id = ed.id
- <where>
- <if test="ids != null and ids != '' and ids.size > 0">
- AND ed.id IN
- <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- </where>
- GROUP BY
- edc.exam_detail_id
- order by bs.name
- </select>
- <select id="findSummarizedData"
- resultType="com.qmth.distributed.print.business.bean.result.SummarizedDataResult">
- SELECT
- det.school_id schoolId,
- sum(ifnull(det.total_subjects, 0)) AS totalSubjects,
- count(det.package_code) AS packageCount,
- GROUP_CONCAT(cou.course_code) AS courseCodes,
- GROUP_CONCAT(cou.paper_number) AS paperNumbers
- FROM
- exam_detail det
- INNER JOIN
- exam_detail_course cou ON det.id = cou.exam_detail_id
- LEFT JOIN
- exam_print_plan epp on epp.id = det.print_plan_id
- LEFT JOIN
- basic_exam be on be.id = epp.exam_id
- LEFT JOIN
- basic_semester bs on bs.id = be.semester_id
- <where>
- <if test="schoolId != null and schoolId > 0">
- AND det.school_id = #{schoolId}
- </if>
- <if test="semesterId != null and semesterId != ''">
- AND bs.id = #{semesterId}
- </if>
- <if test="examId != null and examId != ''">
- AND be.id = #{examId}
- </if>
- <if test="printPlanIdList != null and printPlanIdList != '' and printPlanIdList.size() > 0">
- AND det.print_plan_id IN
- <foreach collection="printPlanIdList" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="courseCode != null and courseCode != ''">
- AND cou.course_code = #{courseCode}
- </if>
- <if test="paperNumber != null and paperNumber != ''">
- AND cou.paper_number = #{paperNumber}
- </if>
- <if test="examPlace != null and examPlace != ''">
- AND det.exam_place = #{examPlace}
- </if>
- <if test="examRoom != null and examRoom != ''">
- AND det.exam_room = #{examRoom}
- </if>
- <if test="packageCode != null and packageCode != ''">
- AND det.package_code = #{packageCode}
- </if>
- <if test="startDate != null and startDate > 0">
- AND det.exam_start_time >= #{startDate}
- </if>
- <if test="endDate != null and endDate > 0">
- AND #{endDate} >= det.exam_end_time
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND det.create_id = #{dpr.requestUserId}
- </if>
- <if test="dpr.orgIdSet != null and dpr.orgIdSet != '' and dpr.orgIdSet.size > 0">
- AND det.org_id IN
- <foreach collection="dpr.orgIdSet" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- </where>
- GROUP BY det.school_id
- <trim prefix="having" suffixOverrides="and">
- <if test="courseCode != null and courseCode != ''">
- find_in_set(#{courseCode},courseCodes) and
- </if>
- <if test="paperNumber != null and paperNumber != ''">
- find_in_set(#{paperNumber},paperNumbers) and
- </if>
- </trim>
- </select>
- <select id="listByExamIdAndCourseCode"
- resultType="com.qmth.distributed.print.business.bean.dto.ExamDetailCourseDto">
- SELECT
- edc.clazz_id clazzId,
- su.login_name loginName,
- su.real_name realName
- FROM
- exam_detail_course edc
- JOIN
- exam_detail ed ON edc.exam_detail_id = ed.id
- left join
- sys_user su ON ed.create_id = su.id
- WHERE
- edc.school_id = #{schoolId} AND ed.exam_id = #{examId}
- AND edc.course_code = #{courseCode} AND ed.status != 'CANCEL'
- </select>
- <select id="listPrintFinishExamDetailCourse"
- resultType="com.qmth.distributed.print.business.bean.dto.initMarkData.ExamDetailCourseInitMarkDto">
- SELECT
- ed.school_id schoolId,
- be.semester_id semesterId,
- ed.exam_id examId,
- edc.course_code courseCode,
- edc.course_name courseName,
- edc.paper_number paperNumber,
- et.id coursePaperId,
- edc.paper_type paperType,
- et.user_id createId,
- ed.exam_start_time examStartTime,
- ed.exam_end_time examEndTime,
- group_concat(ed.package_code) packageCodes,
- group_concat(edc.id) examDetailCourseIds
- FROM
- exam_detail ed
- LEFT JOIN
- exam_detail_course edc ON ed.id = edc.exam_detail_id
- LEFT JOIN
- exam_task et ON ed.exam_id = et.exam_id AND edc.paper_number = et.paper_number
- JOIN
- (select * from basic_exam where enable = true)be ON be.id = ed.exam_id
- WHERE
- ed.status = #{printStatus}
- AND ed.print_end_time > #{startTime}
- AND NOT EXISTS( SELECT
- 1
- FROM
- mark_paper mp
- WHERE
- ed.exam_id = mp.exam_id
- AND edc.paper_number = mp.paper_number
- AND mp.status = #{markStatus})
- GROUP BY ed.school_id , be.semester_id, ed.exam_id , edc.course_code , edc.course_name , edc.paper_number , et.id , edc.paper_type , et.user_id, ed.exam_start_time, ed.exam_end_time
- </select>
- <select id="countMakeupUsedByExamIdAndPaperNumber" resultType="java.lang.Integer">
- SELECT
- COUNT(1)
- FROM
- exam_detail ed
- LEFT JOIN
- exam_detail_course edc ON ed.id = edc.exam_detail_id
- WHERE
- ed.exam_id = #{examId}
- AND edc.paper_number = #{paperNumber}
- AND EXISTS( SELECT
- 1
- FROM
- exam_print_plan epp
- WHERE
- ed.print_plan_id = epp.id
- AND epp.category = 'MAKEUP')
- </select>
- <select id="listByExamIdAndCourseCodeAndPaperNumber"
- resultType="com.qmth.distributed.print.business.entity.ExamDetail">
- SELECT
- b.*
- FROM
- exam_detail_course a
- JOIN
- exam_detail b ON a.exam_detail_id = b.id
- WHERE
- a.school_id = #{schoolId}
- AND b.exam_id = #{examId}
- AND a.course_code = #{courseCode}
- AND a.paper_number = #{paperNumber}
- </select>
- <select id="listPrintFinishPackageCode"
- resultType="com.qmth.distributed.print.business.bean.dto.initMarkData.ExamDetailCourseInitMarkDto">
- SELECT
- ed.exam_id examId,
- edc.course_code courseCode,
- edc.course_name courseName,
- edc.paper_number paperNumber,
- edc.course_paper_id coursePaperId,
- ed.package_code
- FROM
- exam_detail ed
- LEFT JOIN
- exam_detail_course edc ON ed.id = edc.exam_detail_id
- WHERE
- ed.exam_id = #{examId}
- AND edc.paper_number = #{paperNumber}
- AND edc.paper_type LIKE CONCAT('%', #{paperType}, '%')
- AND NOT EXISTS( SELECT
- 1
- FROM
- mark_paper_package mpp
- WHERE
- ed.exam_id = mpp.exam_id
- AND edc.paper_number = mpp.paper_number
- AND mpp.paper_type = #{paperType}
- AND ed.package_code = mpp.package_code)
- </select>
- <select id="listPrintFinishExamDetailCourseIds" resultType="com.qmth.distributed.print.business.bean.dto.initMarkData.InitExamDetailDto">
- SELECT
- edc.id examDetailCourseId,
- ed.exam_place examPlace,
- ed.exam_room examRoom,
- ed.package_code packageCode
- FROM
- exam_detail ed
- LEFT JOIN
- exam_detail_course edc ON ed.id = edc.exam_detail_id
- WHERE
- ed.exam_id = #{examId}
- AND edc.paper_number = #{paperNumber}
- AND edc.paper_type LIKE CONCAT('%', #{paperType}, '%')
- </select>
- </mapper>
|