123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065 |
- <?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.teachcloud.mark.mapper.MarkStudentMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.qmth.teachcloud.mark.entity.MarkStudent">
- <id column="id" property="id"/>
- <result column="exam_id" property="examId"/>
- <result column="paper_number" property="paperNumber"/>
- <result column="course_paper_id" property="coursePaperId"/>
- <result column="secret_number" property="secretNumber"/>
- <result column="student_code" property="studentCode"/>
- <result column="package_code" property="packageCode"/>
- <result column="exam_place" property="examPlace"/>
- <result column="exam_room" property="examRoom"/>
- <result column="remark" property="remark"/>
- <result column="batch_code" property="batchCode"/>
- <result column="sheet_count" property="sheetCount"/>
- <result column="answers" property="answers"/>
- <result column="is_upload" property="upload"/>
- <result column="is_absent" property="absent"/>
- <result column="is_manual_absent" property="manualAbsent"/>
- <result column="is_breach" property="breach"/>
- <result column="upload_time" property="uploadTime"/>
- <result column="check_time" property="checkTime"/>
- <result column="check_user_id" property="checkUserId"/>
- <result column="objective_score" property="objectiveScore"/>
- <result column="objective_score_list" property="objectiveScoreList"/>
- <result column="subjective_status" property="subjectiveStatus"/>
- <result column="subjective_score" property="subjectiveScore"/>
- <result column="subjective_score_list" property="subjectiveScoreList"/>
- <result column="scan_status" property="scanStatus"/>
- <result column="omr_absent_checked" property="omrAbsentChecked"/>
- <result column="question_filled" property="questionFilled"/>
- <result column="assigned" property="assigned"/>
- <result column="absent_suspect" property="absentSuspect"/>
- <result column="incomplete" property="incomplete"/>
- <result column="breach_code" property="breachCode"/>
- <result column="card_number" property="cardNumber"/>
- </resultMap>
- <sql id="pageStudentScoreCommon">
- SELECT
- ms.id studentId,
- ms.exam_id examId,
- bc.code courseCode,
- bc.name courseName,
- ms.paper_number paperNumber,
- ms.paper_type paperType,
- bes.student_name studentName,
- bes.student_code studentCode,
- bes.college_name collegeName,
- ms.secret_number secretNumber,
- bes.college_name college,
- bes.major_name majorName,
- bes.teach_class_name teachClassName,
- bes.class_name className,
- su1.real_name teacherName,
- ms.objective_score objectiveScore,
- ms.subjective_score subjectiveScore,
- ifnull(ms.objective_score, 0) + ifnull(ms.subjective_score, 0) totalScore,
- ms.objective_score_list objectiveScoreList,
- ms.subjective_score_list subjectiveScoreList,
- ms.check_user_id checkUserId,
- su.login_name checkUserLoginName,
- su.real_name checkUserName,
- ms.check_time checkTime,
- ms.sheet_path sheetPath,
- ms.exam_start_time examStartTime,
- ms.exam_end_time examEndTime,
- ms.scan_status scanStatus,
- ms.subjective_status subjectiveStatus,
- ms.is_absent absent,
- ms.omr_absent omrAbsent,
- ms.is_manual_absent manualAbsent,
- ms.is_upload upload,
- bes.status studentStatus,
- ms.is_breach breach,
- ms.omr_breach omrBreach,
- ifnull(ms.is_manual_breach,0) manualBreach
- FROM
- (select * from mark_student where exam_id = #{examId} and paper_number = #{paperNumber}) ms
- LEFT JOIN
- (select * from basic_exam_student where exam_id = #{examId}) bes ON ms.basic_student_id = bes.id
- LEFT JOIN
- basic_course bc ON ms.course_id = bc.id
- LEFT JOIN
- sys_user su ON ms.check_user_id = su.id
- LEFT JOIN
- sys_user su1 ON bes.teacher_id = su1.id
- <where>
- <if test="college != null and college != ''">
- AND bes.college_name LIKE CONCAT('%', #{college}, '%')
- </if>
- <if test="majorName != null and majorName != ''">
- AND bes.major_name LIKE CONCAT('%', #{majorName}, '%')
- </if>
- <if test="teachClassName != null and teachClassName != ''">
- AND bes.teach_class_name LIKE CONCAT('%', #{teachClassName}, '%')
- </if>
- <if test="className != null and className != ''">
- AND bes.class_name LIKE CONCAT('%', #{className}, '%')
- </if>
- <if test="teacher != null and teacher != ''">
- AND su1.real_name LIKE CONCAT('%', #{teacher},'%')
- </if>
- <if test="filter != null">
- <choose>
- <when test="filter == 1">
- AND ms.objective_score = 0
- </when>
- <when test="filter == 2">
- AND ms.objective_score = 0 AND ms.subjective_score > 0
- </when>
- <when test="filter == 3">
- AND ms.objective_score > 0 AND ms.subjective_score = 0
- </when>
- </choose>
- </if>
- <if test="status != null">
- <choose>
- <when test="status == 'ABSENT'">
- AND (ms.is_absent = 1 OR ms.omr_absent = 1 OR ms.is_manual_absent = 1 OR bes.status = 'M')
- </when>
- <when test="status == 'NORMAL'">
- AND (ms.is_absent = 0 and ms.omr_absent = 0 and ms.is_manual_absent = 0 and bes.status != 'M' and ms.scan_status = 'SCANNED' AND ms.is_upload = 1)
- </when>
- <otherwise>
- AND (ms.scan_status = 'UNEXIST' and ms.is_absent = 0 and ms.omr_absent = 0 and ms.is_manual_absent = 0 and bes.status != 'M')
- </otherwise>
- </choose>
- </if>
- <if test="breach != null">
- <choose>
- <when test="breach == true">
- AND (ms.is_breach = 1 OR ms.omr_breach = 1 OR ms.is_manual_breach = 1 OR bes.status = 'B')
- </when>
- <otherwise>
- AND (ms.is_breach = 0 AND ms.omr_breach = 0 AND ms.is_manual_breach = 0 OR bes.status != 'B')
- </otherwise>
- </choose>
- </if>
- <if test="startScore != null">
- <choose>
- <when test="startScore == 0">
- AND (ms.is_absent = 1 OR ms.is_breach = 1 OR ((ifnull(ms.subjective_score, 0) +
- ifnull(ms.objective_score, 0)) >= #{startScore} AND (ifnull(ms.subjective_score,0) +
- ifnull(ms.objective_score,0)) <= #{endScore}))
- </when>
- <otherwise>
- AND (ms.is_absent = 0 AND ms.is_breach = 0 AND ((ifnull(ms.subjective_score,0) +
- ifnull(ms.objective_score,0)) >= #{startScore} AND (ifnull(ms.subjective_score,0) +
- ifnull(ms.objective_score,0)) <= #{endScore}))
- </otherwise>
- </choose>
- </if>
- <if test="subjectiveStartScore != null">
- <choose>
- <when test="subjectiveStartScore == 0">
- AND (ms.is_absent = 1 OR ms.is_breach = 1
- OR ((ifnull(ms.subjective_score, 0) >= #{subjectiveStartScore}
- AND ifnull(ms.subjective_score, 0) <= #{subjectiveEndScore})))
- </when>
- <otherwise>
- AND (ms.is_absent = 0 AND ms.is_breach = 0
- AND ((ifnull(ms.subjective_score, 0) >= #{subjectiveStartScore}
- AND ifnull(ms.subjective_score, 0) <= #{subjectiveEndScore})))
- </otherwise>
- </choose>
- </if>
- <if test="objectiveStartScore != null">
- <choose>
- <when test="objectiveStartScore == 0">
- AND (ms.is_absent = 1 OR ms.is_breach = 1
- OR ((ifnull(ms.objective_score, 0) >= #{objectiveStartScore}
- AND ifnull(ms.objective_score, 0) <= #{objectiveEndScore})))
- </when>
- <otherwise>
- AND (ms.is_absent = 0 AND ms.is_breach = 0
- AND ((ifnull(ms.objective_score, 0) >= #{objectiveStartScore}
- AND ifnull(ms.objective_score, 0) <= #{objectiveEndScore})))
- </otherwise>
- </choose>
- </if>
- <if test="subScore != null">
- AND exists (SELECT 1 FROM mark_subjective_score mss WHERE ms.id = mss.student_id AND mss.score =
- #{subScore})
- </if>
- <if test="objectiveScoreLt != null">
- AND ms.objective_score < #{objectiveScoreLt}
- </if>
- <if test="studentName != null and studentName != ''">
- AND bes.student_name like concat('%',#{studentName}, '%')
- </if>
- <if test="studentCode != null and studentCode != ''">
- AND bes.student_code = #{studentCode}
- </if>
- <if test="secretNumber != null and secretNumber != ''">
- AND ms.secret_number = #{secretNumber}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND bes.teacher_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 = ms.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>
- <if test="orderType != null and orderType != '' and orderField != null and orderField != ''">
- <choose>
- <when test="orderField == 'totalScore'">
- <if test="orderType == 'ASC'">
- order by (ifnull(ms.objective_score, 0) + ifnull(ms.subjective_score, 0)) ASC
- </if>
- <if test="orderType == 'DESC'">
- order by (ifnull(ms.objective_score, 0) + ifnull(ms.subjective_score, 0)) DESC
- </if>
- </when>
- <otherwise>
- order by #{orderField} #{orderType}
- </otherwise>
- </choose>
- </if>
- <if test="orderType == null or orderType == '' or orderField == null or orderField == ''">
- order by ms.is_absent, bes.status desc, bes.student_code
- </if>
- </sql>
- <update id="updateBasicExamStudentPaperType">
- update basic_exam_student set paper_type = #{paperType} where id = #{basicStudentId}
- </update>
- <select id="pageStudentScore" resultType="com.qmth.teachcloud.mark.dto.mark.score.StudentScoreDetailDto">
- <include refid="pageStudentScoreCommon" />
- </select>
- <select id="pageStudentScoreExport" resultType="com.qmth.teachcloud.mark.dto.mark.score.StudentScoreDetailDto">
- <include refid="pageStudentScoreCommon" />
- </select>
- <select id="listAbsentOrBreachMarkTaskStudent" resultMap="BaseResultMap">
- SELECT *
- FROM mark_student ms
- WHERE ms.exam_id = #{examId}
- AND ms.paper_number = #{paperNumber}
- AND ms.is_upload = TRUE
- AND (is_absent = TRUE OR is_manual_absent = TRUE OR omr_absent = TRUE)
- AND EXISTS(SELECT 1
- FROM mark_task mt
- WHERE ms.id = mt.student_id)
- </select>
- <select id="listUnMarkTaskStudent" resultMap="BaseResultMap">
- SELECT ms.*
- FROM mark_student ms
- WHERE ms.exam_id = #{examId}
- AND ms.paper_number = #{paperNumber}
- AND ms.is_upload = TRUE
- AND is_absent = FALSE
- AND is_manual_absent = FALSE
- AND omr_absent = FALSE
- AND NOT EXISTS(SELECT 1
- FROM mark_task mt
- WHERE ms.id = mt.student_id
- AND mt.question_id = #{questionId})
- </select>
- <sql id="queryWhereAndOrder">
- where t.exam_id=#{query.examId}
- <if test="query.studentId != null and query.studentId !=''">
- and t.id=#{query.studentId}
- </if>
- <if test="query.status != null and query.status.size>0">
- AND t.scan_status in
- <foreach collection="query.status" index="index" item="st"
- open="(" separator="," close=")">
- #{st}
- </foreach>
- </if>
- <if test="query.studentCode != null and query.studentCode !=''">
- and t.student_code=#{query.studentCode}
- </if>
- <if test="query.studentName != null and query.studentName !=''">
- and bes.student_name=#{query.studentName}
- </if>
- <if test="query.packageCode != null and query.packageCode !=''">
- and t.package_code=#{query.packageCode}
- </if>
- <if test="query.courseId != null">
- and t.course_id=#{query.courseId}
- </if>
- <if test="query.coursePaperId != null and query.coursePaperId !=''">
- and t.course_paper_id=#{query.coursePaperId}
- </if>
- <if test="query.coursePaperNumber != null and query.coursePaperNumber !=''">
- and t.paper_number=#{query.coursePaperNumber}
- </if>
- <if test="query.examPlace != null and query.examPlace !=''">
- and bes.exam_place=#{query.examPlace}
- </if>
- <if test="query.examRoom != null and query.examRoom !=''">
- and bes.exam_room=#{query.examRoom}
- </if>
- <if test="query.absentSuspect != null">
- and t.absent_suspect=#{query.absentSuspect}
- </if>
- <if test="query.omrAbsent != null">
- and t.omr_absent=#{query.omrAbsent}
- </if>
- <if test="query.omrAbsentChecked != null">
- and t.omr_absent_checked=#{query.omrAbsentChecked}
- </if>
- <if test="query.manualAbsent != null">
- and t.is_manual_absent=#{query.manualAbsent}
- </if>
- <if test="query.assigned != null">
- and t.assigned=#{query.assigned}
- </if>
- <if test="query.assignConfirmed != null">
- and t.assign_confirmed=#{query.assignConfirmed}
- </if>
- <if test="query.invalid != null">
- and t.invalid=#{query.invalid}
- </if>
- <if test="query.incomplete != null">
- and t.incomplete=#{query.incomplete}
- </if>
- <if test="query.questionFilled != null">
- and t.question_filled=#{query.questionFilled}
- </if>
- <if test="query.missScan != null">
- and t.miss_scan=#{query.missScan}
- </if>
- <if test="query.studentCodeOrName != null and query.studentCodeOrName !=''">
- and (t.student_code=#{query.studentCodeOrName} or bes.student_name=#{query.studentCodeOrName})
- </if>
- <if test="query.paperType != null and query.paperType != ''">
- and ifnull(t.paper_type, '#') = #{query.paperType}
- </if>
- <if test="query.paperTypeCheckStatus != null">
- and t.paper_type_check_status=#{query.paperTypeCheckStatus}
- </if>
- <if test="query.omrBreach != null">
- and t.omr_breach = #{query.omrBreach}
- </if>
- <if test="query.manualBreach != null">
- and t.is_manual_breach = #{query.manualBreach}
- </if>
- <if test="dpr != null and dpr.requestUserId != null">
- AND t.create_id = #{dpr.requestUserId}
- </if>
- </sql>
- <select id="queryPage"
- resultType="com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryVo">
- select t.id,
- bes.student_code,
- bes.site_number,
- bes.student_name,
- bc.code courseCode,
- bc.name courseName,
- t.course_paper_id,
- bes.exam_place,
- bes.exam_room,
- t.package_code,
- t.absent_suspect,
- t.omr_absent,
- t.omr_absent_checked,
- t.is_manual_absent manualAbsent,
- t.assigned,
- t.invalid,
- t.incomplete,
- t.card_number,
- t.is_absent,
- t.scan_status status,
- t.paper_number coursePaperNumber,
- c.paper_count cardPaperCount,
- t.paper_type paperType,
- t.paper_type_check_status paperTypeCheckStatus,
- t.miss_scan missScan,
- t.omr_breach omrBreach,
- t.is_manual_breach manualBreach
- from mark_student t
- inner join basic_exam_student bes on t.basic_student_id = bes.id
- left join scan_answer_card c on t.exam_id=c.exam_id and t.card_number=c.number
- inner join mark_paper s on s.course_paper_id=t.course_paper_id and s.exam_id=t.exam_id
- <if test="query.markPaperStatus != null">
- and s.status = #{query.markPaperStatus}
- </if>
- left join sys_user su on t.create_id = su.id
- inner join basic_course bc on t.course_id = bc.id
- <if test="dpr != null and 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>
- <include refid="queryWhereAndOrder"/>
- order by t.id
- </select>
- <select id="querySummary" resultType="java.lang.String">
- select
- t.id
- from mark_student t
- inner join basic_exam_student bes on t.basic_student_id = bes.id
- inner join mark_paper s on s.course_paper_id=t.course_paper_id and s.exam_id=t.exam_id
- <if test="query.markPaperStatus != null">
- and s.status = #{query.markPaperStatus}
- </if>
- left join sys_user su on t.create_id = su.id
- inner join basic_course bc on t.course_id = bc.id
- <if test="dpr != null and 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>
- <include refid="queryWhereAndOrder"/>
- order by t.id
- </select>
- <select id="findIdByExamIdAndPaperNumber" resultType="java.lang.Long">
- select id
- from mark_student
- where exam_id = #{examId}
- and paper_number = #{paperNumber}
- </select>
- <select id="studentList"
- resultType="com.qmth.teachcloud.mark.bean.archivescore.ArchiveStudentVo">
- select s.id studentId,
- s.paper_type paperType,
- s.objective_score objectiveScore,
- s.subjective_score subjectiveScore,
- ifnull(s.objective_score, 0) + ifnull(s.subjective_score, 0) totalScore,
- s.objective_score_list objectiveScoreList,
- s.subjective_score_list subjectiveScoreList,
- s.check_user_id checkUserId,
- s.check_time checkTime,
- s.sheet_path sheetPath,
- s.scan_status scanStatus,
- s.subjective_status subjectiveStatus,
- s.is_absent absent,
- s.omr_absent omrAbsent,
- ifnull(s.is_manual_absent,0) manualAbsent,
- s.is_upload upload,
- bes.status studentStatus,
- s.is_breach breach,
- s.omr_breach omrBreach,
- ifnull(s.is_manual_breach,0) manualBreach,
- bes.student_code studentCode,
- bes.student_name studentName,
- bes.college_name collegeName,
- bes.major_name majorName,
- bes.class_name className,
- bes.teach_class_name teachClassName,
- bc.code courseCode,
- bc.name courseName,
- su.real_name teacherName,
- bes.exam_start_time examStartTime,
- bes.exam_end_time examEndTime
- from mark_student s
- left join basic_exam_student bes on s.basic_student_id = bes.id
- left join sys_user su on bes.teacher_id = su.id
- left join (select * from basic_course where school_id = #{schoolId}) bc on s.course_id = bc.id
- <include refid="archiveQuery"/>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND bes.teacher_id = #{dpr.requestUserId}
- </if>
- <if test="dpr.courseUserId != null">
- AND EXISTS( SELECT 1 FROM (select course_id from teach_course where exam_id = #{req.examId} and user_id = #{dpr.courseUserId}) tc WHERE tc.course_id = s.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>
- <if test="req.orderType != null and req.orderType != '' and req.orderField != null and req.orderField != ''">
- <choose>
- <when test="req.orderField == 'totalScore'">
- <if test="req.orderType == 'ASC'">
- order by (ifnull(s.objective_score, 0) + ifnull(s.subjective_score, 0)) ASC
- </if>
- <if test="req.orderType == 'DESC'">
- order by (ifnull(s.objective_score, 0) + ifnull(s.subjective_score, 0)) DESC
- </if>
- </when>
- <otherwise>
- order by #{req.orderField} #{req.orderType}
- </otherwise>
- </choose>
- </if>
- <if test="req.orderType == null or req.orderType == '' or req.orderField == null or req.orderField == ''">
- order by s.is_absent, bes.status desc, bes.student_code
- </if>
- </select>
- <sql id="archiveQuery">
- where s.exam_id=#{req.examId} and s.paper_number=#{req.paperNumber}
- <if test="req.studentCode != null and req.studentCode !=''">
- and bes.student_code=#{req.studentCode}
- </if>
- <if test="req.startStudentCode != null and req.startStudentCode !=''">
- and bes.student_code >= #{req.startStudentCode}
- </if>
- <if test="req.endStudentCode != null and req.endStudentCode !=''">
- and bes.student_code <= #{req.endStudentCode}
- </if>
- <if test="req.studentName != null and req.studentName !=''">
- and bes.student_name=#{req.studentName}
- </if>
- <if test="req.college != null and req.college !=''">
- and bes.college_name like concat(#{req.college}, '%')
- </if>
- <if test="req.majorName != null and req.majorName !=''">
- and bes.major_name like concat(#{req.majorName}, '%')
- </if>
- <if test="req.teachClassName != null and req.teachClassName !=''">
- and bes.teach_class_name like concat(#{req.teachClassName}, '%')
- </if>
- <if test="req.className != null and req.className !=''">
- and bes.class_name like concat(#{req.className}, '%')
- </if>
- <if test="req.startScore != null and req.startScore !=''">
- and (ifnull(s.objective_score,0)+ifnull(s.subjective_score,0)) >= #{req.startScore}
- </if>
- <if test="req.endScore != null and req.endScore !=''">
- and (ifnull(s.objective_score,0)+ifnull(s.subjective_score,0)) <= #{req.endScore}
- </if>
- <if test="req.objectiveStartScore != null and req.objectiveStartScore !=''">
- and ifnull(s.objective_score,0) >= #{req.objectiveStartScore}
- </if>
- <if test="req.objectiveEndScore != null and req.objectiveEndScore !=''">
- and ifnull(s.objective_score,0) <= #{req.objectiveEndScore}
- </if>
- <if test="req.subjectiveStartScore != null and req.subjectiveStartScore !=''">
- and ifnull(s.subjective_score,0) >= #{req.subjectiveStartScore}
- </if>
- <if test="req.subjectiveEndScore != null and req.subjectiveEndScore !=''">
- and ifnull(s.subjective_score,0) <= #{req.subjectiveEndScore}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND bes.teacher_id = #{dpr.requestUserId}
- </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>
- </sql>
- <select id="overview" resultType="com.qmth.teachcloud.mark.bean.archivescore.OverViewVo">
- SELECT count(*) studentCount,
- sum(case
- when s.is_absent = 0 and s.omr_absent = 0 and s.is_breach = 0 and s.is_upload = 1 then 1
- else 0 end) actualCount,
- sum(case when s.is_absent = 1 or s.omr_absent = 1 then 1 else 0 end) absentCount,
- sum(case when s.is_breach = 1 then 1 else 0 end) breachCount,
- avg(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) avgScore,
- max(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) maxScore,
- min(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) minScore,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.pass_score / 100 then 1
- else 0 end) passCount,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.excellent_score / 100 then 1
- else 0 end) excellentCount
- FROM mark_student s
- left join (select * from basic_exam_student where exam_id=#{req.examId}) bes on s.basic_student_id = bes.id
- left join mark_paper t on s.exam_id = t.exam_id
- and s.paper_number = t.paper_number
- left join sys_user su on bes.teacher_id = su.id
- left join (select * from basic_course where school_id = #{schoolId}) bc on s.course_id = bc.id
- <include refid="archiveQuery"/>
- </select>
- <select id="getCountByScoreRange" resultType="int">
- SELECT count(*)
- FROM mark_student s
- WHERE s.exam_id = #{examId}
- and s.paper_number = #{paperNumber}
- and s.is_absent !=1 and s.objective_score+s.subjective_score>=#{start}
- and s.objective_score+s.subjective_score<=#{end}
- </select>
- <select id="college" resultType="com.qmth.teachcloud.mark.bean.archivescore.CollegeVo">
- SELECT bes.college_name college,
- count(*) studentCount,
- sum(case when s.is_absent = 1 then 1 else 0 end) absentCount,
- avg(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) avgScore,
- max(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) maxScore,
- min(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) minScore,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.pass_score / 100 then 1
- else 0 end) passCount,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.excellent_score / 100 then 1
- else 0 end) excellentCount
- FROM mark_student s
- left join mark_paper t on s.exam_id = t.exam_id
- and s.paper_number = t.paper_number
- left join (select * from basic_exam_student where exam_id=#{req.examId}) bes on s.basic_student_id = bes.id
- left join sys_user su on bes.teacher_id = su.id
- left join (select * from basic_course where school_id = #{schoolId}) bc on s.course_id = bc.id
- <include refid="archiveQuery"/>
- and bes.college_name is not null
- group by bes.college_name
- </select>
- <select id="classData" resultType="com.qmth.teachcloud.mark.bean.archivescore.ClassVo">
- SELECT bes.teach_class_name className,
- count(*) studentCount,
- sum(case when s.is_absent = 1 then 1 else 0 end) absentCount,
- avg(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) avgScore,
- max(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) maxScore,
- min(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) minScore,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.pass_score / 100 then 1
- else 0 end) passCount,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.excellent_score / 100 then 1
- else 0 end) excellentCount
- FROM mark_student s
- left join mark_paper t on s.exam_id = t.exam_id
- and s.paper_number = t.paper_number
- left join (select * from basic_exam_student where exam_id=#{req.examId}) bes on s.basic_student_id = bes.id
- left join sys_user su on bes.teacher_id = su.id
- left join (select * from basic_course where school_id = #{schoolId}) bc on s.course_id = bc.id
- <include refid="archiveQuery"/>
- and bes.teach_class_name is not null
- group by bes.teach_class_name
- </select>
- <select id="teacher" resultType="com.qmth.teachcloud.mark.bean.archivescore.TeacherVo">
- SELECT su.real_name teacher,
- bes.teacher_id,
- count(*) studentCount,
- sum(case when s.is_absent = 1 then 1 else 0 end) absentCount,
- avg(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) avgScore,
- max(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) maxScore,
- min(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) minScore,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.pass_score / 100 then 1
- else 0 end) passCount,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.excellent_score / 100 then 1
- else 0 end) excellentCount
- FROM mark_student s
- left join mark_paper t on s.exam_id = t.exam_id
- and s.paper_number = t.paper_number
- left join (select * from basic_exam_student where exam_id=#{req.examId}) bes on s.basic_student_id = bes.id
- left join sys_user su on bes.teacher_id = su.id
- left join (select * from basic_course where school_id = #{schoolId}) bc on s.course_id = bc.id
- <include refid="archiveQuery"/>
- and su.real_name is not null
- group by bes.teacher_id, su.real_name
- </select>
- <select id="findOne" resultType="com.qmth.teachcloud.mark.bean.student.StudentVo"
- parameterType="com.qmth.teachcloud.mark.bean.student.StudentQuery">
- select ms.id,
- bes.student_code studentCode,
- bes.student_name studentName,
- bc.code courseCode,
- bc.name courseName,
- ms.course_paper_id coursePaperId,
- ms.paper_number coursePaperNumber,
- ms.package_code packageCode,
- bes.site_number siteNumber,
- ms.exam_room examRoom,
- ms.scan_status status
- from mark_student ms join basic_exam_student bes on ms.basic_student_id = bes.id
- left join basic_course bc on ms.course_id = bc.id
- where ms.exam_id = #{query.examId}
- and ms.course_paper_id = #{query.coursePaperId}
- and bes.student_code = #{query.studentCode}
- </select>
- <select id="listUnexistStudentByExamIdAndCoursePaperId"
- resultType="com.qmth.teachcloud.mark.dto.UnexistStudentDto">
- SELECT
- bc.code courseCode,
- bc.name courseName,
- so.name teachingRoomName,
- t.paper_number paperNumber,
- t.student_code studentCode,
- bes.student_name studentName
- FROM
- (select * from mark_student where exam_id = #{examId}) t
- left join (select * from basic_exam_student where exam_id = #{examId}) bes on t.basic_student_id = bes.id
- left join sys_user su on t.create_id = su.id
- left join basic_course bc on t.course_id = bc.id
- left join sys_org so on bc.teaching_room_id = so.id
- WHERE
- t.scan_status = 'UNEXIST'
- <if test="courseId != null">
- and t.course_id = #{courseId}
- </if>
- <if test="coursePaperId != null and coursePaperId != ''">
- and t.course_paper_id = #{coursePaperId}
- </if>
- <if test="status != null and status != ''">
- and exists(select 1 from mark_paper mp where t.exam_id = mp.exam_id and t.course_paper_id =
- mp.course_paper_id and mp.status = #{status})
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND t.create_id = #{dpr.requestUserId}
- </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>
- order by t.student_code
- </select>
- <select id="teacherClass" resultType="com.qmth.teachcloud.mark.bean.archivescore.TeacherClassVo">
- SELECT bes.teacher_id,
- su.real_name teacher,
- bes.teach_class_name className,
- count(*) studentCount,
- sum(case when s.is_absent = 1 then 1 else 0 end) absentCount,
- avg(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) avgScore,
- max(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) maxScore,
- min(case when s.is_absent !=1 then ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) else null end) minScore,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.pass_score / 100 then 1
- else 0 end) passCount,
- sum(case
- when ifnull(s.objective_score,0) + ifnull(s.subjective_score,0) >= t.total_score * t.excellent_score / 100 then 1
- else 0 end) excellentCount
- FROM mark_student s
- left join mark_paper t on s.exam_id = t.exam_id
- and s.paper_number = t.paper_number
- left join (select * from basic_exam_student where exam_id=#{req.examId}) bes on s.basic_student_id = bes.id
- left join sys_user su on bes.teacher_id = su.id
- left join (select * from basic_course where school_id = #{schoolId}) bc on s.course_id = bc.id
- <include refid="archiveQuery"/>
- and bes.teach_class_name is not null
- group by bes.teacher_id, su.real_name, bes.teach_class_name
- </select>
- <select id="selectCountByQuery" resultType="java.lang.Integer">
- select count(1) from mark_student ms INNER join basic_course bc on ms.course_id = bc.id
- <if test="dpr != null and 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 test="markStudent.markPaperStatus != null">
- INNER JOIN mark_paper mp ON ms.exam_id = mp.exam_id
- and ms.paper_number = mp.paper_number
- and mp.status = #{markStudent.markPaperStatus}
- </if>
- <where>
- and ms.exam_id = #{markStudent.examId}
- <if test="markStudent.courseId != null">
- and ms.course_id = #{markStudent.courseId}
- </if>
- <if test="markStudent.paperNumber != null and markStudent.paperNumber != ''">
- and ms.paper_number = #{markStudent.paperNumber}
- </if>
- <if test="markStudent.paperType != null and markStudent.paperType != ''">
- and ms.paper_type = #{markStudent.paperType}
- </if>
- <if test="markStudent.coursePaperId != null and markStudent.coursePaperId != ''">
- and ms.course_paper_id = #{markStudent.coursePaperId}
- </if>
- <if test="markStudent.scanStatus != null">
- and ms.scan_status = #{markStudent.scanStatus}
- </if>
- <if test="markStudent.manualAbsent != null">
- and ms.is_manual_absent = #{markStudent.manualAbsent}
- </if>
- <if test="markStudent.omrAbsent != null">
- and ms.omr_absent = #{markStudent.omrAbsent}
- </if>
- <if test="markStudent.omrAbsentChecked != null">
- and ms.omr_absent_checked = #{markStudent.omrAbsentChecked}
- </if>
- <if test="markStudent.incomplete != null">
- and ms.incomplete = #{markStudent.incomplete}
- </if>
- <if test="markStudent.missScan != null">
- and ms.miss_scan = #{markStudent.missScan}
- </if>
- <if test="markStudent.paperTypeCheckStatus != null">
- and ms.paper_type_check_status = #{markStudent.paperTypeCheckStatus}
- </if>
- <if test="dpr != null and dpr.requestUserId != null">
- AND ms.create_id = #{dpr.requestUserId}
- </if>
- </where>
- </select>
- <select id="countAssigned" resultType="java.lang.Integer">
- SELECT
- count(1)
- FROM
- mark_student ms
- LEFT JOIN basic_course bc ON ms.course_id = bc.id
- <if test="dpr != null and 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 test="markStudent.markPaperStatus != null">
- INNER JOIN mark_paper mp ON ms.exam_id = mp.exam_id
- and ms.paper_number = mp.paper_number
- and mp.status = #{markStudent.markPaperStatus}
- </if>
- <where>
- ms.exam_id = #{markStudent.examId}
- <if test="markStudent.courseId != null">
- AND ms.course_id = #{markStudent.courseId}
- </if>
- <if test="markStudent.coursePaperId != null">
- AND ms.course_paper_id = #{markStudent.coursePaperId}
- </if>
- <if test="markStudent.assigned != null">
- AND ms.assigned = #{markStudent.assigned}
- </if>
- <if test="markStudent.assignConfirmed != null">
- AND ms.assign_confirmed = #{markStudent.assignConfirmed}
- </if>
- <if test="dpr != null and dpr.requestUserId != null">
- AND ms.create_id = #{dpr.requestUserId}
- </if>
- </where>
- </select>
- <select id="listScanCollegeByExamIdAndCourseCodeAndCoursePaperId"
- resultType="com.qmth.teachcloud.mark.entity.MarkStudent">
- SELECT
- distinct ms.exam_place, ms.exam_room
- FROM
- mark_student ms
- LEFT JOIN basic_course bc ON ms.course_id = bc.id
- <where>
- ms.exam_id = #{examId}
- <if test="courseId != null">
- AND ms.course_id = #{courseId}
- </if>
- <if test="coursePaperId != null and coursePaperId != ''">
- AND ms.course_paper_id = #{coursePaperId}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND ms.create_id = #{dpr.requestUserId}
- </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>
- <if test="status != null">
- AND exists(select 1 from mark_paper mp where ms.exam_id = mp.exam_id and ms.paper_number =
- mp.paper_number and mp.status = #{status})
- </if>
- </where>
- </select>
- <select id="getBasicTeachClazzById" resultType="com.qmth.teachcloud.common.entity.BasicTeachClazz"
- parameterType="java.lang.Long">
- select * from basic_teach_clazz where id = #{clazzId}
- </select>
- <select id="maxCardNumber" resultType="java.lang.Integer">
- select max(card_number) from mark_student where exam_id = #{examId} and paper_number = #{paperNumber} and card_number is not null
- </select>
- <select id="selectByExamIdAndCoursePaperIdAndStudentCode"
- resultType="com.qmth.teachcloud.mark.entity.MarkStudent">
- select ms.id,
- bes.student_code,
- bes.student_name,
- bc.code courseCode,
- bc.name courseName,
- ms.paper_number,
- ms.course_paper_id,
- ms.exam_id,
- ms.exam_place,
- ms.exam_room,
- ms.scan_status,
- ms.is_absent absent,
- ms.is_upload upload,
- ms.is_manual_absent manualAbsent,
- ms.omr_absent,
- ms.omr_absent_checked
- from mark_student ms
- LEFT JOIN
- basic_exam_student bes on ms.basic_student_id = bes.id
- left join
- basic_course bc on bc.id = bes.course_id
- where ms.exam_id = #{examId} and ms.course_paper_id = #{coursePaperId} and bes.student_code = #{studentCode}
- </select>
- <select id="listMarkStudentVo" resultType="com.qmth.teachcloud.mark.dto.mark.MarkStudentVo">
- SELECT
- ms.*,
- ms.is_upload upload,
- ms.is_absent absent,
- ms.is_breach breach,
- ms.is_manual_absent manualAbsent,
- bes.student_name,
- bc.code courseCode,
- bc.name courseName,
- bes.college_name,
- bes.major_name,
- bes.teach_class_name AS teachClassName,
- bes.class_name,
- su.real_name teacher,
- bes.teacher_id
- FROM
- mark_student ms
- LEFT JOIN
- basic_exam_student bes ON ms.basic_student_id = bes.id
- LEFT JOIN
- basic_course bc ON ms.course_id = bc.id
- LEFT JOIN
- sys_user su ON bes.teacher_id = su.id
- <where>
- <if test="markStudentQuery.id != null">
- and ms.id = #{markStudentQuery.id}
- </if>
- <if test="markStudentQuery.examId != null">
- and ms.exam_id = #{markStudentQuery.examId}
- </if>
- <if test="markStudentQuery.paperNumber != null">
- and ms.paper_number = #{markStudentQuery.paperNumber}
- </if>
- <if test="markStudentQuery.upload != null">
- and ms.is_upload = #{markStudentQuery.upload}
- </if>
- <if test="markStudentQuery.absent != null">
- and ms.is_absent = #{markStudentQuery.absent}
- </if>
- <if test="markStudentQuery.breach != null">
- and ms.is_breach = #{markStudentQuery.breach}
- </if>
- <if test="markStudentQuery.omrAbsent != null">
- and ms.omr_absent = #{markStudentQuery.omrAbsent}
- </if>
- </where>
- </select>
- <select id="countOmrAbsentStudent" resultType="java.lang.Integer">
- select count(1) from mark_student ms
- left join basic_exam_student bes on bes.id = ms.basic_student_id
- <where> 1 = 1
- <if test="examId != null and examId != ''">
- and ms.exam_id = #{examId}
- </if>
- <if test="paperNumber != null and paperNumber != ''">
- and ms.paper_number = #{paperNumber}
- </if>
- and ms.omr_absent = true
- <if test="isOmrAbsentConfirm != null and isOmrAbsentConfirm != '' or isOmrAbsentConfirm == 0">
- and ms.omr_absent_checked = #{isOmrAbsentConfirm}
- </if>
- <if test="teachClassName != null and teachClassName != ''">
- and bes.teach_class_name = #{teachClassName}
- </if>
- </where>
- </select>
- <select id="countAssignedNew" resultType="java.lang.Integer">
- SELECT
- count(1)
- FROM
- mark_student ms
- LEFT JOIN basic_course bc ON ms.course_id = bc.id
- left join basic_exam_student bes on bes.id = ms.basic_student_id
- <where>
- ms.exam_id = #{markStudent.examId}
- <if test="markStudent.courseId != null">
- AND ms.course_id = #{markStudent.courseId}
- </if>
- <if test="markStudent.coursePaperId != null">
- AND ms.course_paper_id = #{markStudent.coursePaperId}
- </if>
- <if test="markStudent.assigned != null">
- AND ms.assigned = #{markStudent.assigned}
- </if>
- <if test="markStudent.assignConfirmed != null">
- AND ms.assign_confirmed = #{markStudent.assignConfirmed}
- </if>
- <if test="dpr != null">
- <if test="dpr.requestUserId != null">
- AND ms.create_id = #{dpr.requestUserId}
- </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>
- <if test="markStudent.markPaperStatus != null">
- AND exists(select 1 from mark_paper mp where ms.exam_id = mp.exam_id and ms.paper_number =
- mp.paper_number and mp.status = #{markStudent.markPaperStatus})
- </if>
- <if test="teachClassName != null and teachClassName != ''">
- and bes.teach_class_name = #{teachClassName}
- </if>
- </where>
- </select>
- <select id="getDetailById" resultType="com.qmth.teachcloud.mark.dto.mark.MarkStudentVo">
- SELECT
- bes.student_code,
- bes.student_name,
- bc.code courseCode,
- bc.name courseName,
- ms.paper_number,
- bes.college_name,
- bes.major_name,
- bes.teach_class_name,
- bes.class_name
- FROM
- mark_student ms
- LEFT JOIN
- basic_exam_student bes ON ms.basic_student_id = bes.id
- LEFT JOIN
- basic_course bc ON ms.course_id = bc.id
- where
- ms.id = #{studentId}
- </select>
- <select id="findExamTaskPaperTypeOpenStatus" resultType="com.qmth.teachcloud.mark.dto.mark.AbInfoVo">
- SELECT
- et.open_ab openAb,
- bcr.paper_type paperTypeStyle
- FROM
- exam_task et
- LEFT JOIN
- basic_card_rule bcr ON et.card_rule_id = bcr.id
- <where>
- <if test="examId != null">
- AND exam_id = #{examId}
- </if>
- <if test="paperNumber != null and paperNumber != ''">
- AND paper_number = #{paperNumber}
- </if>
- </where>
- </select>
- <select id="findUnMarked" resultType="java.lang.Long">
- SELECT m.id
- FROM mark_student m
- <where>
- m.exam_id = #{examId}
- AND m.paper_number = #{paperNumber}
- AND m.subjective_status = 'UNMARK'
- AND EXISTS(SELECT 1
- FROM mark_task mt
- WHERE m.id = mt.student_id)
- <if test="classMark == true">
- AND EXISTS (
- SELECT 1
- FROM
- (select * from mark_user_class where exam_id = #{examId} and paper_number = #{paperNumber} and user_id = #{userId}) mc
- join
- (select ms.id, bes.teach_class_name from (select * from mark_student where exam_id = #{examId} and paper_number = #{paperNumber}) ms join (select id,teach_class_name from basic_exam_student where exam_id = #{examId}) bes on ms.basic_student_id = bes.id) s on mc.class_name = s.teach_class_name
- WHERE m.id = s.id
- )
- </if>
- </where>
- </select>
- </mapper>
|