StudentMapper.xml 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="cn.com.qmth.scancentral.dao.StudentDao">
  4. <select id="absentInfo"
  5. resultType="cn.com.qmth.scancentral.vo.AbsentInfoVo">
  6. select
  7. count(1) totalCount,
  8. sum(case
  9. when t.status='SCANNED' then 1 else 0 end)
  10. scannedCount,
  11. sum(case when
  12. t.status='UNEXIST' then 1 else 0 end)
  13. unexistCount,
  14. sum(case when
  15. t.status='MANUAL_ABSENT' then 1 else 0 end)
  16. manualAbsentCount,
  17. sum(case
  18. when t.omr_absent=1 then 1 else 0 end)
  19. omrAbsentCount,
  20. sum(case when
  21. t.absent_suspect=1 then 1 else 0 end)
  22. absentSuspectCount
  23. from sc_student t
  24. where t.exam_id=#{examId}
  25. <if test="groupType != null and groupName != null">
  26. and t.${groupType}=#{groupName}
  27. </if>
  28. group by t.exam_id
  29. <if test="groupType != null and groupName != null">
  30. , t.${groupType}
  31. </if>
  32. </select>
  33. <select id="absentQuerySummary" resultType="string">
  34. select tem.groupName from (
  35. <include refid="absentInnerQuery"/>
  36. ) tem
  37. <include refid="absentWhereQuery"/>
  38. </select>
  39. <select id="absentExportList"
  40. resultType="cn.com.qmth.scancentral.vo.AbsentQueryVo">
  41. select tem.* from (
  42. <include refid="absentInnerQuery"/>
  43. ) tem
  44. <include refid="absentWhereQuery"/>
  45. </select>
  46. <select id="absentQueryPage"
  47. resultType="cn.com.qmth.scancentral.vo.AbsentQueryVo">
  48. select tem.* from (
  49. <include refid="absentInnerQuery"/>
  50. ) tem
  51. <include refid="absentWhereQuery"/>
  52. </select>
  53. <select id="queryPage"
  54. resultType="cn.com.qmth.scancentral.vo.answerquery.AnswerQueryVo">
  55. select
  56. t.*,
  57. c.paper_count cardPaperCount,
  58. s.name subjectName
  59. from sc_student t
  60. left join sc_answer_card c on t.exam_id=c.exam_id and
  61. t.card_number=c.number
  62. left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
  63. <include refid="paramWhereAndOrder"/>
  64. order by t.id
  65. </select>
  66. <select id="querySummary" resultType="string">
  67. select
  68. t.exam_number
  69. from sc_student t
  70. left join sc_subject s on s.exam_id=t.exam_id and s.code=t.subject_code
  71. <include refid="paramWhereAndOrder"/>
  72. order by t.id
  73. </select>
  74. <select id="exportList"
  75. resultType="cn.com.qmth.scancentral.vo.AnswerExportVo">
  76. select
  77. t.*,
  78. s.name subjectName,
  79. (select count(sp.paper_id) from sc_student_paper sp where sp.student_id=t.id)
  80. as paperCount
  81. from sc_student t
  82. left join sc_subject s on s.code = t.subject_code and s.exam_id =
  83. t.exam_id
  84. <include refid="paramWhereAndOrder"/>
  85. order by t.id
  86. </select>
  87. <select id="findToUpload"
  88. resultType="cn.com.qmth.scancentral.vo.StudentUploadVo">
  89. select t.*
  90. from sc_student t
  91. inner join sc_exam e on t.exam_id = e.id
  92. where e.enable_upload = 1
  93. and e.enable = 1
  94. and (t.file_upload_status = 'WAITING_UPLOAD' or t.data_upload_status =
  95. 'WAITING_UPLOAD')
  96. limit #{pageSize}
  97. </select>
  98. <select id="findUploadError"
  99. resultType="cn.com.qmth.scancentral.vo.StudentUploadVo">
  100. select t.*
  101. from sc_student t
  102. inner join sc_exam e on t.exam_id = e.id
  103. where e.enable_upload = 1
  104. and e.enable = 1
  105. and (t.file_upload_status = 'ERROR' or t.data_upload_status = 'ERROR')
  106. limit #{pageSize}
  107. </select>
  108. <select id="getPackageCountByExam" resultType="int">
  109. select count(distinct t.package_code)
  110. from sc_student t
  111. where t.exam_id = #{examId}
  112. </select>
  113. <select id="countByQuery" resultType="int">
  114. select count(*) from sc_student t
  115. where t.exam_id=#{query.examId}
  116. <if test="query.examNumber != null and query.examNumber !=''">
  117. and t.exam_number=#{query.examNumber}
  118. </if>
  119. <if test="query.name != null and query.name !=''">
  120. and t.name=#{query.name}
  121. </if>
  122. <if test="query.packageCode != null and query.packageCode !=''">
  123. and t.package_code=#{query.packageCode}
  124. </if>
  125. <if test="query.campusName != null and query.campusName !=''">
  126. and t.campus_name=#{query.campusName}
  127. </if>
  128. <if test="query.subjectCode != null and query.subjectCode !=''">
  129. and t.subject_code=#{query.subjectCode}
  130. </if>
  131. <if test="query.examSite != null and query.examSite!=''">
  132. and t.exam_site=#{query.examSite}
  133. </if>
  134. <if test="query.examRoom != null and query.examRoom !=''">
  135. and t.exam_room=#{query.examRoom}
  136. </if>
  137. <if test="query.seatNumber != null and query.seatNumber !=''">
  138. and t.seat_number=#{query.seatNumber}
  139. </if>
  140. <if test="query.scanStatus != null">
  141. and t.status=#{query.scanStatus}
  142. </if>
  143. </select>
  144. <select id="countStudent" resultType="cn.com.qmth.scancentral.vo.studentimport.StudentCountVo">
  145. select sb.code as subject_code, sb.name as subjectName
  146. ,(select count(1) from sc_student stu where stu.exam_id=sb.exam_id and stu.subject_code = sb.code) studentCount
  147. from sc_subject sb
  148. where sb.exam_id = #{examId}
  149. </select>
  150. <select id="listPageQuery"
  151. resultType="cn.com.qmth.scancentral.vo.ImportStudentVo">
  152. select
  153. t.id,
  154. t.exam_number,
  155. t.student_code,
  156. t.name,
  157. t.subject_code,
  158. s.name subjectName,
  159. t.package_code,
  160. t.campus_name,
  161. t.campus_code,
  162. t.exam_site,
  163. t.exam_site_name,
  164. t.exam_room,
  165. t.seat_number
  166. from sc_student t
  167. left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
  168. where t.exam_id=#{query.examId}
  169. <if test="query.examNumber != null and query.examNumber !=''">
  170. and t.exam_number=#{query.examNumber}
  171. </if>
  172. <if test="query.name != null and query.name !=''">
  173. and t.name=#{query.name}
  174. </if>
  175. <if test="query.packageCode != null and query.packageCode !=''">
  176. and t.package_code=#{query.packageCode}
  177. </if>
  178. <if test="query.campusName != null and query.campusName !=''">
  179. and t.campus_name=#{query.campusName}
  180. </if>
  181. <if test="query.subjectCode != null and query.subjectCode !=''">
  182. and t.subject_code=#{query.subjectCode}
  183. </if>
  184. <if test="query.examSite != null and query.examSite!=''">
  185. and t.exam_site=#{query.examSite}
  186. </if>
  187. <if test="query.examRoom != null and query.examRoom !=''">
  188. and t.exam_room=#{query.examRoom}
  189. </if>
  190. <if test="query.seatNumber != null and query.seatNumber !=''">
  191. and t.seat_number=#{query.seatNumber}
  192. </if>
  193. <if test="query.scanStatus != null">
  194. and t.status=#{query.scanStatus}
  195. </if>
  196. order by t.id
  197. </select>
  198. <select id="findToPictureCopy"
  199. resultType="cn.com.qmth.scancentral.vo.StudentUploadVo">
  200. select t.*,
  201. e.mode
  202. from sc_student t
  203. inner join sc_exam e on t.exam_id = e.id
  204. where e.enable = 1
  205. and e.mode = 'CET'
  206. and t.file_upload_status = 'WAITING_UPLOAD'
  207. limit #{pageSize}
  208. </select>
  209. <select id="getUploadedCount" resultType="int">
  210. select count(1)
  211. from sc_student t
  212. where t.exam_id = #{examId}
  213. and t.file_upload_status = 'UPLOADED'
  214. and t.data_upload_status = 'UPLOADED'
  215. </select>
  216. <select id="getNeedUploadCount" resultType="int">
  217. select count(1)
  218. from sc_student t
  219. where t.exam_id = #{examId}
  220. and (
  221. t.file_upload_status in ('WAITING_UPLOAD', 'ERROR') or
  222. t.data_upload_status in ('WAITING_UPLOAD', 'ERROR')
  223. )
  224. </select>
  225. <select id="listCetMarkingPage"
  226. resultType="cn.com.qmth.scancentral.vo.ExportCetVo">
  227. select t.*
  228. from sc_student t
  229. where t.exam_id = #{query.examId}
  230. <if test="query.subjectCode != null and query.subjectCode !=''">
  231. and t.subject_code=#{query.subjectCode}
  232. </if>
  233. and t.status = 'SCANNED'
  234. and t.file_upload_status = 'UPLOADED'
  235. order by t.id
  236. </select>
  237. <select id="countCetMarking" resultType="int">
  238. select count(1)
  239. from sc_student t
  240. where t.exam_id = #{query.examId}
  241. <if test="query.subjectCode != null and query.subjectCode !=''">
  242. and t.subject_code=#{query.subjectCode}
  243. </if>
  244. and t.status = 'SCANNED'
  245. and t.file_upload_status = 'UPLOADED'
  246. </select>
  247. <select id="getInfoCountByExam" resultType="cn.com.qmth.scancentral.vo.ScanAnswerInfoVo">
  248. select count(1) as totalCount,
  249. count(case when t.absent_suspect = 1 then 1 end) as absentSuspectCount,
  250. count(case when t.assigned = 1 then 1 end) as assignedCount,
  251. count(case when t.omr_absent = 1 then 1 end) as omrAbsentCount,
  252. count(case when t.incomplete = 1 then 1 end) as incompleteCount,
  253. count(case when t.status = 'MANUAL_ABSENT' then 1 end) as manualAbsentCount,
  254. count(case when t.status = 'SCANNED' then 1 end) as scannedCount,
  255. count(case when t.status = 'UNEXIST' then 1 end) as unexistCount
  256. from sc_student t
  257. where t.exam_id = #{examId}
  258. </select>
  259. <sql id="queryWhereAndOrder">
  260. where t.exam_id=#{query.examId}
  261. <if test="query.status != null and query.status.size>0">
  262. AND t.status in
  263. <foreach collection="query.status" index="index" item="st"
  264. open="(" separator="," close=")">
  265. #{st}
  266. </foreach>
  267. </if>
  268. <if test="query.examStatus != null">
  269. and t.exam_status=#{query.examStatus}
  270. </if>
  271. <if test="query.examNumber != null and query.examNumber !=''">
  272. and t.exam_number =#{query.examNumber}
  273. </if>
  274. <if test="query.name != null and query.name !=''">
  275. and t.name=#{query.name}
  276. </if>
  277. <if test="query.packageCode != null and query.packageCode !=''">
  278. and t.package_code=#{query.packageCode}
  279. </if>
  280. <if test="query.campusName != null and query.campusName !=''">
  281. and t.campus_name=#{query.campusName}
  282. </if>
  283. <if test="query.campusCode != null and query.campusCode !=''">
  284. and t.campus_code=#{query.campusCode}
  285. </if>
  286. <if test="query.subjectCode != null and query.subjectCode !=''">
  287. and t.subject_code=#{query.subjectCode}
  288. </if>
  289. <if test="query.examSite != null and query.examSite!=''">
  290. and t.exam_site=#{query.examSite}
  291. </if>
  292. <if test="query.examRoom != null and query.examRoom !=''">
  293. and t.exam_room=#{query.examRoom}
  294. </if>
  295. <if test="query.province != null and query.province !=''">
  296. and t.province=#{query.province}
  297. </if>
  298. <if test="query.absentSuspect != null">
  299. and t.absent_suspect=#{query.absentSuspect}
  300. </if>
  301. <if test="query.omrAbsent != null">
  302. and t.omr_absent=#{query.omrAbsent}
  303. </if>
  304. <if test="query.assigned != null">
  305. and t.assigned=#{query.assigned}
  306. </if>
  307. <if test="query.incomplete != null">
  308. and t.incomplete=#{query.incomplete}
  309. </if>
  310. <if test="query.questionFilled != null">
  311. and t.question_filled=#{query.questionFilled}
  312. </if>
  313. <if test="query.subjectiveFilled != null">
  314. and t.subjective_filled=#{query.subjectiveFilled}
  315. </if>
  316. <if test="query.device != null and query.device !=''">
  317. and t.device=#{query.device}
  318. </if>
  319. <if test="query.assignedCheckCount != null and query.assignedCheckCount !=''">
  320. and t.assigned_check_count=#{query.assignedCheckCount}
  321. </if>
  322. <if test="query.assignedSuspect != null">
  323. and t.assigned_suspect=#{query.assignedSuspect}
  324. </if>
  325. <if test="query.paperTypeStatus != null">
  326. <if test="query.paperTypeStatus ==@cn.com.qmth.scancentral.enums.PaperTypeStatus@OK">
  327. and t.paper_type!='#' and t.paper_type!='?'
  328. </if>
  329. <if test="query.paperTypeStatus ==@cn.com.qmth.scancentral.enums.PaperTypeStatus@BLANK">
  330. and t.paper_type='#'
  331. </if>
  332. <if test="query.paperTypeStatus ==@cn.com.qmth.scancentral.enums.PaperTypeStatus@ERROR">
  333. and t.paper_type='?'
  334. </if>
  335. </if>
  336. </sql>
  337. <sql id="absentInnerQuery">
  338. select
  339. #{query.groupType} groupType,
  340. t.${groupNameCol} groupName,
  341. count(1) totalCount,
  342. sum(case
  343. when t.status='SCANNED' then 1 else 0 end)
  344. scannedCount,
  345. sum(case when
  346. t.status='UNEXIST' then 1 else 0 end)
  347. unexistCount,
  348. sum(case when
  349. t.status='MANUAL_ABSENT' then 1 else 0 end)
  350. manualAbsentCount,
  351. sum(case
  352. when t.omr_absent=1 then 1 else 0 end)
  353. omrAbsentCount,
  354. sum(case when
  355. t.absent_suspect=1 then 1 else 0 end)
  356. absentSuspectCount
  357. from sc_student t
  358. where
  359. t.exam_id=#{query.examId}
  360. and t.${groupNameCol} is not null
  361. <if test="query.campusCode != null and query.campusCode!=''">
  362. and t.campus_code=#{query.campusCode}
  363. </if>
  364. <if test="query.subjectCode != null and query.subjectCode !=''">
  365. and t.subject_code=#{query.subjectCode}
  366. </if>
  367. <if test="query.examSite != null and query.examSite !=''">
  368. and t.exam_site=#{query.examSite}
  369. </if>
  370. <if test="query.examRoom != null and query.examRoom !=''">
  371. and t.exam_room=#{query.examRoom}
  372. </if>
  373. group by t.${groupNameCol}
  374. </sql>
  375. <sql id="absentWhereQuery">
  376. where 1=1
  377. <if test="!query.status.isEmpty()">
  378. and (1=2
  379. <if test="query.status.contains('UNEXIST')">
  380. or tem.unexistCount>0
  381. </if>
  382. <if test="query.status.contains('MANUAL_ABSENT')">
  383. or tem.manualAbsentCount>0
  384. </if>
  385. <if test="query.status.contains('OMR_ABSENT')">
  386. or tem.omrAbsentCount>0
  387. </if>
  388. <if test="query.status.contains('ABSENT_SUSPECT')">
  389. or tem.absentSuspectCount>0
  390. </if>
  391. )
  392. </if>
  393. <if test="query.scanned != null">
  394. <if test="query.scanned">
  395. and tem.scannedCount>0
  396. </if>
  397. <if test="!query.scanned">
  398. and tem.scannedCount=0
  399. </if>
  400. </if>
  401. order by tem.groupName
  402. </sql>
  403. <select id="exportAssignedCheckPage"
  404. resultType="cn.com.qmth.scancentral.vo.assginedcheck.AssignedCheckExport">
  405. select t.*
  406. from sc_student t
  407. <include refid="queryWhereAndOrder"/>
  408. order by t.id
  409. </select>
  410. <select id="queryAssignedCheckPage"
  411. resultType="cn.com.qmth.scancentral.vo.answerquery.AnswerQueryVo">
  412. select
  413. t.*,
  414. s.name subjectName,
  415. h.user_id auditorId
  416. from sc_student t
  417. left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
  418. left join (
  419. SELECT MAX(id) id,student_id FROM sc_assigned_check_history h GROUP BY student_id
  420. ) m on t.id=m.student_id
  421. left join sc_assigned_check_history h on h.id=m.id and h.student_id=t.id
  422. <!-- <if test="query.startTime != null || query.endTime != null">-->
  423. <!-- left join sc_student_paper sp on sp.student_id=t.id-->
  424. <!-- </if>-->
  425. <include refid="queryWhereAndOrder"/>
  426. <if test="query.auditorId != null">
  427. and h.user_id = #{query.auditorId}
  428. </if>
  429. <if test="query.startTime != null">
  430. and t.update_time &gt;= #{query.startTime}
  431. </if>
  432. <if test="query.endTime != null">
  433. and t.update_time &lt;= #{query.endTime}
  434. </if>
  435. order by t.id
  436. </select>
  437. <select id="findUnCheck" resultType="cn.com.qmth.scancentral.vo.answerquery.AnswerQueryVo">
  438. select t.*,
  439. c.paper_count cardPaperCount,
  440. s.name subjectName
  441. from sc_student t
  442. left join sc_answer_card c on t.exam_id = c.exam_id and
  443. t.card_number = c.number
  444. left join sc_subject s on s.code = t.subject_code and s.exam_id = t.exam_id
  445. where t.exam_id = #{examId}
  446. and t.subject_code = #{subjectCode}
  447. and t.assigned_check_count = #{checkCount}
  448. and t.assigned = 1
  449. order by t.id
  450. </select>
  451. <select id="getAssignedCheckTaskHistory" resultType="cn.com.qmth.scancentral.vo.answerquery.AnswerQueryVo">
  452. select t.*,
  453. c.paper_count cardPaperCount,
  454. s.name subjectName
  455. from sc_assigned_check_history h
  456. left join sc_student t on t.id = h.student_id
  457. left join sc_answer_card c on t.exam_id = c.exam_id and
  458. t.card_number = c.number
  459. left join sc_subject s on s.code = t.subject_code and s.exam_id = t.exam_id
  460. where h.user_id = #{userId}
  461. and h.exam_id = #{examId}
  462. and h.subject_code = #{subjectCode}
  463. order by h.id desc
  464. </select>
  465. <update id="updateAssignedCheckCount">
  466. UPDATE sc_student
  467. SET assigned_check_count = (SELECT count(1)
  468. FROM sc_assigned_check_history h
  469. WHERE h.student_id = #{id})
  470. WHERE id = #{id}
  471. </update>
  472. <select id="scanProgress" resultType="cn.com.qmth.scancentral.vo.subject.SubjectScanProgressVo">
  473. select t.subject_code,s.name subject_name,
  474. sum(case when t.status='UNEXIST' then 1 else 0 end) unexistCount,
  475. count(1) studentCount
  476. from sc_student t
  477. inner join sc_subject s on t.exam_id=s.exam_id and t.subject_code=s.code
  478. where t.exam_id=#{examId}
  479. <if test="subjectCode != null and subjectCode !=''">
  480. and t.subject_code=#{subjectCode}
  481. </if>
  482. group by t.subject_code
  483. </select>
  484. <select id="studentPage" resultType="cn.com.qmth.scancentral.vo.student.StudentPageVo">
  485. select t.*,ss.device_name,su.name subjectName
  486. from sc_student t
  487. left join sc_scanner ss on t.device=ss.device
  488. left join sc_subject su on t.exam_id=su.exam_id and t.subject_code=su.code
  489. where t.exam_id=#{req.examId}
  490. <if test="req.campusCode != null and req.campusCode !=''">
  491. and t.campus_code=#{req.campusCode}
  492. </if>
  493. <if test="req.examNumber != null and req.examNumber !=''">
  494. and t.exam_number=#{req.examNumber}
  495. </if>
  496. <if test="req.subjectCode != null and req.subjectCode !=''">
  497. and t.subject_code=#{req.subjectCode}
  498. </if>
  499. <if test="req.examSite != null and req.examSite !=''">
  500. and t.exam_site=#{req.examSite}
  501. </if>
  502. <if test="req.name != null and req.name !=''">
  503. and t.name like concat('%',#{req.name}, '%')
  504. </if>
  505. <if test="req.packageCode != null and req.packageCode !=''">
  506. and t.package_code=#{req.packageCode}
  507. </if>
  508. </select>
  509. <select id="studentExport"
  510. resultType="cn.com.qmth.scancentral.vo.student.StudentVo">
  511. select
  512. t.*,
  513. s.name subjectName
  514. from sc_student t
  515. left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
  516. <include refid="paramWhereAndOrder"/>
  517. order by t.exam_number
  518. </select>
  519. <select id="studentExamRoomExport"
  520. resultType="cn.com.qmth.scancentral.vo.student.StudentExamRoomVo">
  521. select tm.* from (select t.campus_code,t.exam_site,t.exam_site_name,t.exam_room,
  522. s.code subject_code,
  523. s.name subject_name
  524. from sc_student t
  525. left join sc_subject s on s.code=t.subject_code and s.exam_id=t.exam_id
  526. <include refid="paramWhereAndOrder"/>
  527. group by t.campus_code,t.exam_site,t.exam_room,s.code
  528. ) tm
  529. order by tm.exam_site,tm.exam_room
  530. </select>
  531. <select id="queryImageCheckWaitingList" resultType="java.lang.Long">
  532. select id
  533. from sc_student
  534. where exam_id = #{examId}
  535. and file_upload_status = 'UPLOADED'
  536. and image_check_status in ('WAITING', 'FAILED')
  537. and id > #{startId}
  538. order by id
  539. limit #{batchSize}
  540. </select>
  541. <select id="countImageCheck" resultType="cn.com.qmth.scancentral.vo.imagecheck.ImageCheckVo">
  542. select stu.subject_code,
  543. sb.name as subjectName,
  544. count(1) as totalCount,
  545. sum(case
  546. when
  547. (stu.file_upload_status = 'ERROR')
  548. or (stu.file_upload_status = 'UPLOADED' and stu.image_check_status in('SUCCESS','FAILED') )
  549. then 1
  550. else 0 end) disposedCount,
  551. sum(case
  552. when stu.file_upload_status = 'ERROR' or stu.image_check_status = 'FAILED' then 1
  553. else 0 end) failedCount
  554. from sc_student stu
  555. inner join sc_subject sb on sb.exam_id = stu.exam_id and sb.code = stu.subject_code
  556. where stu.exam_id = #{examId}
  557. group by stu.subject_code
  558. </select>
  559. <select id="failedPage" resultType="cn.com.qmth.scancentral.vo.imagecheck.ImageCheckDetailVo">
  560. select stu.subject_code,
  561. sb.name as subject_name,
  562. stu.campus_code,
  563. stu.campus_name,
  564. stu.exam_site,
  565. stu.exam_site_name,
  566. stu.exam_room,
  567. stu.image_check_status,
  568. sum(case when stu.file_upload_status='ERROR' or stu.image_check_status = 'FAILED' then 1 else 0 end)
  569. failedCount
  570. from sc_student stu
  571. inner join sc_subject sb on sb.exam_id = stu.exam_id and sb.code = stu.subject_code
  572. where stu.exam_id = #{query.examId}
  573. and stu.subject_code = #{query.subjectCode}
  574. and (stu.file_upload_status = 'ERROR' or stu.image_check_status = 'FAILED')
  575. group by stu.exam_room
  576. </select>
  577. <select id="exportAssignedCheck" resultType="cn.com.qmth.scancentral.vo.assginedcheck.AssignedCheckExamRoomExport">
  578. select stu.subject_code,
  579. sb.name as subject_name,
  580. stu.campus_code,
  581. stu.campus_name,
  582. stu.exam_site,
  583. stu.exam_site_name,
  584. stu.exam_room
  585. from sc_student stu
  586. left join sc_subject sb on sb.exam_id = stu.exam_id and sb.code = stu.subject_code
  587. where stu.exam_id = #{examId}
  588. and stu.subject_code = #{subjectCode}
  589. and stu.assigned = 1
  590. and stu.assigned_suspect = 1
  591. group by stu.exam_room
  592. </select>
  593. <select id="getStudentVo"
  594. resultType="cn.com.qmth.scancentral.vo.student.StudentAnswerVo">
  595. select t.*,
  596. c.paper_count cardPaperCount,
  597. s.name subjectName
  598. from sc_student t
  599. left join sc_answer_card c on t.exam_id = c.exam_id and
  600. t.card_number = c.number
  601. left join sc_subject s on s.code = t.subject_code and s.exam_id = t.exam_id
  602. where t.id = #{studentId}
  603. </select>
  604. <select id="getImageCheckFailedCount" resultType="int">
  605. select count(*)
  606. from sc_student stu
  607. where stu.exam_id = #{examId}
  608. and stu.subject_code = #{subjectCode}
  609. and (stu.file_upload_status = 'ERROR' or stu.image_check_status = 'FAILED')
  610. </select>
  611. <select id="getImageCheckDisposedCount" resultType="int">
  612. select count(*)
  613. from sc_student stu
  614. where stu.exam_id = #{examId}
  615. and stu.subject_code = #{subjectCode}
  616. and ((stu.file_upload_status = 'ERROR')
  617. or (stu.file_upload_status = 'UPLOADED' and stu.image_check_status in('SUCCESS','FAILED')) )
  618. </select>
  619. <select id="getImageCheckUnFinish" resultType="long">
  620. select stu.id
  621. from sc_student stu
  622. where stu.exam_id = #{examId}
  623. and stu.subject_code = #{subjectCode}
  624. and (
  625. stu.file_upload_status in('WAITING_UPLOAD','ERROR')
  626. or
  627. (stu.file_upload_status='UPLOADED' and stu.image_check_status in('WAITING','FAILED') )
  628. )
  629. limit 1
  630. </select>
  631. <sql id="paramWhereAndOrder">
  632. where t.exam_id=#{query.examId}
  633. <if test="query.status != null and query.status.size>0">
  634. AND t.status in
  635. <foreach collection="query.status" index="index" item="st"
  636. open="(" separator="," close=")">
  637. #{st}
  638. </foreach>
  639. </if>
  640. <if test="query.examStatus != null and query.examStatus.size>0">
  641. AND t.exam_status in
  642. <foreach collection="query.examStatus" index="index" item="st"
  643. open="(" separator="," close=")">
  644. #{st}
  645. </foreach>
  646. </if>
  647. <if test="query.examNumber != null and query.examNumber.size>0">
  648. and t.exam_number in
  649. <foreach collection="query.examNumber" index="index" item="en"
  650. open="(" separator="," close=")">
  651. #{en}
  652. </foreach>
  653. </if>
  654. <if test="query.name != null and query.name !=''">
  655. and t.name=#{query.name}
  656. </if>
  657. <if test="query.packageCode != null and query.packageCode !=''">
  658. and t.package_code=#{query.packageCode}
  659. </if>
  660. <if test="query.campusName != null and query.campusName !=''">
  661. and t.campus_name=#{query.campusName}
  662. </if>
  663. <if test="query.campusCode != null and query.campusCode !=''">
  664. and t.campus_code=#{query.campusCode}
  665. </if>
  666. <if test="query.subjectCode != null and query.subjectCode !=''">
  667. and t.subject_code=#{query.subjectCode}
  668. </if>
  669. <if test="query.examSite != null and query.examSite!=''">
  670. and t.exam_site=#{query.examSite}
  671. </if>
  672. <if test="query.examRoom != null and query.examRoom !=''">
  673. and t.exam_room=#{query.examRoom}
  674. </if>
  675. <if test="query.province != null and query.province !=''">
  676. and t.province=#{query.province}
  677. </if>
  678. <if test="query.absentSuspect != null">
  679. and t.absent_suspect=#{query.absentSuspect}
  680. </if>
  681. <if test="query.omrAbsent != null">
  682. and t.omr_absent=#{query.omrAbsent}
  683. </if>
  684. <if test="query.assigned != null">
  685. and t.assigned=#{query.assigned}
  686. </if>
  687. <if test="query.incomplete != null">
  688. and t.incomplete=#{query.incomplete}
  689. </if>
  690. <if test="query.questionFilled != null">
  691. and t.question_filled=#{query.questionFilled}
  692. </if>
  693. <if test="query.subjectiveFilled != null">
  694. and t.subjective_filled=#{query.subjectiveFilled}
  695. </if>
  696. <if test="query.device != null and query.device !=''">
  697. and t.device=#{query.device}
  698. </if>
  699. <if test="query.assignedCheckCount != null and query.assignedCheckCount !=''">
  700. and t.assigned_check_count=#{query.assignedCheckCount}
  701. </if>
  702. <if test="query.assignedSuspect != null">
  703. and t.assigned_suspect=#{query.assignedSuspect}
  704. </if>
  705. <if test="query.paperTypeStatus != null">
  706. <if test="query.paperTypeStatus ==@cn.com.qmth.scancentral.enums.PaperTypeStatus@OK">
  707. and t.paper_type!='#' and t.paper_type!='?'
  708. </if>
  709. <if test="query.paperTypeStatus ==@cn.com.qmth.scancentral.enums.PaperTypeStatus@BLANK">
  710. and t.paper_type='#'
  711. </if>
  712. <if test="query.paperTypeStatus ==@cn.com.qmth.scancentral.enums.PaperTypeStatus@ERROR">
  713. and t.paper_type='?'
  714. </if>
  715. </if>
  716. <if test="query.hasFilled != null">
  717. <if test="query.hasFilled">
  718. and (t.question_filled=1 or t.subjective_filled=1)
  719. </if>
  720. <if test="!query.hasFilled">
  721. and t.question_filled=0 and t.subjective_filled=0
  722. </if>
  723. </if>
  724. </sql>
  725. </mapper>