TCFinalScoreMapper.xml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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="com.qmth.distributed.print.business.mapper.TCFinalScoreMapper">
  4. <select id="finalScoreList" resultType="com.qmth.distributed.print.business.entity.TCFinalScore">
  5. select * from t_c_final_score t
  6. <where>
  7. <if test="examId != null and examId != ''">
  8. and t.exam_id = #{examId}
  9. </if>
  10. <if test="courseCode != null and courseCode != ''">
  11. and t.course_code = #{courseCode}
  12. </if>
  13. <if test="paperNumber != null and paperNumber != ''">
  14. and t.paper_number = #{paperNumber}
  15. </if>
  16. </where>
  17. </select>
  18. <select id="finalScoreScoreOverView" resultType="com.qmth.distributed.print.business.bean.dto.FinalScoreDto">
  19. select count(1) as studentCount,
  20. max(case when tcfs.score is not null then tcfs.score else null end) finalScoreMaxScore,
  21. min(case when tcfs.score is not null then tcfs.score else null end) finalScoreMinScore,
  22. avg(case when tcfs.score is not null then tcfs.score else null end) finalScoreAvgScore
  23. from t_c_final_score tcfs
  24. join t_c_usual_score tcus on tcfs.exam_id = tcus.exam_id and tcfs.course_code = tcus.course_code and tcfs.paper_number and tcus.paper_number and tcfs.student_code = tcus.student_code
  25. <where>
  26. <if test="examId != null and examId != ''">
  27. and tcfs.exam_id = #{examId}
  28. </if>
  29. <if test="courseCode != null and courseCode != ''">
  30. and tcfs.course_code = #{courseCode}
  31. </if>
  32. <if test="paperNumber != null and paperNumber != ''">
  33. and tcfs.paper_number = #{paperNumber}
  34. </if>
  35. </where>
  36. </select>
  37. <select id="getCountByScoreRange" resultType="int">
  38. SELECT count(1) FROM t_c_final_score tcfs
  39. <where>
  40. <if test="examId != null and examId != ''">
  41. and tcfs.exam_id = #{examId}
  42. </if>
  43. <if test="courseCode != null and courseCode != ''">
  44. and tcfs.course_code = #{courseCode}
  45. </if>
  46. <if test="paperNumber != null and paperNumber != ''">
  47. and tcfs.paper_number = #{paperNumber}
  48. </if>
  49. and tcfs.score &gt;= #{start} and tcfs.score &lt;= #{end}
  50. </where>
  51. </select>
  52. <select id="examStudentOverview" resultType="com.qmth.distributed.print.business.bean.result.FinalScoreResult">
  53. select
  54. tcfs.name,
  55. tcfs.student_code as studentCode,
  56. tcfs.score as finalScore,
  57. tcfs.score_detail as finalScoreDetail,
  58. tcus.score as usualScore,
  59. es.clazz_name as administrativeClass
  60. from t_c_final_score tcfs
  61. join t_c_usual_score tcus on tcfs.exam_id = tcus.exam_id and tcfs.course_code = tcus.course_code and tcfs.paper_number and tcus.paper_number and tcfs.student_code = tcus.student_code
  62. join exam_student es on es.exam_id = tcfs.exam_id and es.paper_number = tcfs.paper_number and es.student_code = tcfs.student_code
  63. <where>
  64. <if test="examId != null and examId != ''">
  65. and tcfs.exam_id = #{examId}
  66. </if>
  67. <if test="courseCode != null and courseCode != ''">
  68. and tcfs.course_code = #{courseCode}
  69. </if>
  70. <if test="paperNumber != null and paperNumber != ''">
  71. and tcfs.paper_number = #{paperNumber}
  72. </if>
  73. </where>
  74. </select>
  75. </mapper>