AssessmentTemplatePlanMapper.xml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xjrsoft.module.assessment.mapper.AssessmentTemplatePlanMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.assessment.dto.AssessmentTemplatePlanPageDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentTemplatePlanPageVo">
  7. SELECT t1.id,t1.name,t1.score,t1.start_time,t1.status,t1.end_time,t2.name AS assessment_template_name,
  8. t1.assessment_template_id,t1.type,t1.random_number FROM assessment_template_plan t1
  9. LEFT JOIN assessment_template t2 ON t1.assessment_template_id = t2.id
  10. WHERE t1.delete_mark = 0
  11. <if test="dto.name != null and dto.name != ''">
  12. and t1.name like concat('%', #{dto.name}, '%')
  13. </if>
  14. <if test="dto.assessmentTemplateName != null and dto.assessmentTemplateName != ''">
  15. and t2.name like concat('%', #{dto.assessmentTemplateName}, '%')
  16. </if>
  17. <if test="dto.keyword != null and dto.keyword != ''">
  18. and (t2.name like concat('%', #{dto.keyword}, '%') or t1.name like concat('%', #{dto.keyword}, '%'))
  19. </if>
  20. <if test="dto.assessmentTemplateId != null">
  21. and t2.id = #{dto.assessmentTemplateId}
  22. </if>
  23. <if test="dto.status != null">
  24. and t1.status = #{dto.status}
  25. </if>
  26. ORDER BY t1.create_date DESC
  27. </select>
  28. <select id="getStudentPage" parameterType="com.xjrsoft.module.assessment.dto.AssessmentPlanAnswerPageDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerStudentPageVo">
  29. SELECT t1.id,t1.name,t1.score,t1.start_time,t1.status,t1.end_time,t2.name AS assessment_template_name,
  30. t1.assessment_template_id,t3.is_confirm,t3.submit_status FROM assessment_template_plan t1
  31. LEFT JOIN assessment_template t2 ON t1.assessment_template_id = t2.id
  32. LEFT JOIN assessment_plan_answer_student t3 ON t3.assessment_template_plan_id = t1.id
  33. LEFT JOIN base_student_school_roll t4 ON t3.student_user_id = t4.user_id
  34. LEFT JOIN assessment_plan_answer_class t5 ON t5.assessment_template_plan_id = t1.id AND t4.class_id = t5.class_id
  35. WHERE t1.delete_mark = 0 AND t1.status = 1 AND t3.student_user_id = #{dto.studentUserId}
  36. and t5.is_confirm = t1.is_need_confirm and t1.stduy_status like concat('%', t4.stduy_status, '%')
  37. <if test="dto.name != null and dto.name != ''">
  38. and t1.name like concat('%', #{dto.name}, '%')
  39. </if>
  40. <if test="dto.assessmentTemplateName != null and dto.assessmentTemplateName != ''">
  41. and t2.name like concat('%', #{dto.assessmentTemplateName}, '%')
  42. </if>
  43. <if test="dto.keyword != null and dto.keyword != ''">
  44. and (t2.name like concat('%', #{dto.keyword}, '%') or t1.name like concat('%', #{dto.keyword}, '%'))
  45. </if>
  46. <if test="dto.assessmentTemplateId != null">
  47. and t2.id = #{dto.assessmentTemplateId}
  48. </if>
  49. <if test="dto.status != null">
  50. and t1.status = #{dto.status}
  51. </if>
  52. ORDER BY t1.create_date asc
  53. </select>
  54. <select id="getTeacherPage" parameterType="com.xjrsoft.module.assessment.dto.AssessmentPlanAnswerPageDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerTeacherPageVo">
  55. SELECT t1.id,t1.name,t1.score,t1.start_time,t1.status,t1.end_time,t2.name AS assessment_template_name,
  56. t1.assessment_template_id,t3.is_confirm,t3.class_id,t4.name as class_name,
  57. (select count(*) from assessment_plan_answer_student a1
  58. left join base_student_school_roll a2 on a1.student_user_id = a2.user_id
  59. where a1.delete_mark = 0 and a1.assessment_template_plan_id = t1.id and a2.class_id = t3.class_id and a1.submit_status = 1) as submitted_count,
  60. (select count(*) from assessment_plan_answer_student a1
  61. left join base_student_school_roll a2 on a1.student_user_id = a2.user_id
  62. where a1.delete_mark = 0 and a1.assessment_template_plan_id = t1.id and a2.class_id = t3.class_id and a1.submit_status = 0) as unsubmitted_count,
  63. (t4.teacher_id = #{dto.teacherId}) AS is_mine,t1.is_need_confirm FROM assessment_template_plan t1
  64. LEFT JOIN assessment_template t2 ON t1.assessment_template_id = t2.id
  65. LEFT JOIN assessment_plan_answer_class t3 ON t3.assessment_template_plan_id = t1.id
  66. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  67. WHERE t1.delete_mark = 0 AND t1.status in (1, 2)
  68. <if test="dto.teacherId != null and dto.isHeadTeacher != null and dto.isHeadTeacher == 1">
  69. AND t4.teacher_id = #{dto.teacherId}
  70. </if>
  71. <if test="dto.name != null and dto.name != ''">
  72. and t1.name like concat('%', #{dto.name}, '%')
  73. </if>
  74. <if test="dto.assessmentTemplateName != null and dto.assessmentTemplateName != ''">
  75. and t2.name like concat('%', #{dto.assessmentTemplateName}, '%')
  76. </if>
  77. <if test="dto.keyword != null and dto.keyword != ''">
  78. and (t2.name like concat('%', #{dto.keyword}, '%') or t1.name like concat('%', #{dto.keyword}, '%'))
  79. </if>
  80. <if test="dto.assessmentTemplateId != null">
  81. and t2.id = #{dto.assessmentTemplateId}
  82. </if>
  83. <if test="dto.assessmentTemplatePlanId != null">
  84. and t1.id = #{dto.assessmentTemplatePlanId}
  85. </if>
  86. <if test="dto.status != null">
  87. and t1.status = #{dto.status}
  88. </if>
  89. ORDER BY t1.create_date asc
  90. </select>
  91. <select id="getMobilePage" parameterType="com.xjrsoft.module.assessment.dto.AssessmentTemplatePlanPageDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentTemplatePlanPageVo">
  92. SELECT t1.id,t1.name,t1.score,t1.start_time,t1.status,t1.end_time,t2.name AS assessment_template_name,
  93. t1.assessment_template_id,
  94. (SELECT COUNT(*) FROM assessment_plan_answer_student WHERE delete_mark = 0 AND assessment_template_plan_id = t1.id AND submit_status = 1) AS submittedCount,
  95. (SELECT COUNT(*) FROM assessment_plan_answer_student WHERE delete_mark = 0 AND assessment_template_plan_id = t1.id AND (submit_status = 0 OR submit_status IS NULL)) AS unsubmittedCount,
  96. (SELECT COUNT(*) FROM assessment_plan_answer_student WHERE delete_mark = 0 AND assessment_template_plan_id = t1.id) AS allCount
  97. FROM assessment_template_plan t1
  98. LEFT JOIN assessment_template t2 ON t1.assessment_template_id = t2.id
  99. WHERE t1.delete_mark = 0 AND t1.status = 1
  100. <if test="dto.keyword != null and dto.keyword != ''">
  101. and t1.name like concat('%', #{dto.keyword}, '%')
  102. </if>
  103. ORDER BY t1.create_date asc
  104. </select>
  105. <select id="getAnswerStudent" parameterType="com.xjrsoft.module.assessment.dto.AssessmentPlanAnswerStudentDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerStudentVo">
  106. SELECT t1.student_user_id,t4.name AS class_name,t1.modify_date AS submit_date,t2.name,t1.submit_status,t1.assessment_template_plan_id FROM assessment_plan_answer_student t1
  107. LEFT JOIN xjr_user t2 ON t1.student_user_id = t2.id
  108. LEFT JOIN base_student_school_roll t3 ON t1.student_user_id = t3.user_id
  109. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  110. WHERE t1.delete_mark = 0 AND t1.assessment_template_plan_id = #{dto.assessmentTemplatePlanId}
  111. and t1.submit_status = 1
  112. <if test="dto.keyword != null and dto.keyword != ''">
  113. and (t2.name like concat('%', #{dto.keyword}, '%') or t4.name like concat('%', #{dto.keyword}, '%'))
  114. </if>
  115. <if test="dto.name != null and dto.name != ''">
  116. and (t2.name like concat('%', #{dto.name}, '%') or t4.name like concat('%', #{dto.name}, '%'))
  117. </if>
  118. <if test="dto.teacherId != null">
  119. AND t4.teacher_id = #{dto.teacherId}
  120. </if>
  121. <if test="dto.classId != null">
  122. AND t4.id = #{dto.classId}
  123. </if>
  124. </select>
  125. <select id="getSemesterClass" resultType="java.lang.Long">
  126. SELECT distinct t1.class_id FROM assessment_plan_answer_class t1
  127. INNER JOIN assessment_template_plan t2 ON t1.assessment_template_plan_id = t2.id
  128. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0 AND t2.status in (0, 1) AND t2.base_semester_id = #{id}
  129. </select>
  130. <select id="getAnswerStudentList" parameterType="com.xjrsoft.module.assessment.dto.AssessmentPlanAnswerStudentDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerStudentVo">
  131. SELECT t1.student_user_id,t4.name AS class_name,t1.modify_date AS submit_date,t2.name,t1.submit_status,t1.assessment_template_plan_id FROM assessment_plan_answer_student t1
  132. LEFT JOIN xjr_user t2 ON t1.student_user_id = t2.id
  133. LEFT JOIN base_student_school_roll t3 ON t1.student_user_id = t3.user_id
  134. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  135. WHERE t1.delete_mark = 0 AND t1.assessment_template_plan_id = #{dto.assessmentTemplatePlanId}
  136. <if test="dto.submitStatus != null and dto.submit_status == 1">
  137. and t1.submit_status = 1
  138. </if>
  139. <if test="dto.keyword != null and dto.keyword != ''">
  140. and (t2.name like concat('%', #{dto.keyword}, '%') or t4.name like concat('%', #{dto.keyword}, '%'))
  141. </if>
  142. <if test="dto.name != null and dto.name != ''">
  143. and (t2.name like concat('%', #{dto.name}, '%') or t4.name like concat('%', #{dto.name}, '%'))
  144. </if>
  145. <if test="dto.teacherId != null">
  146. AND t4.teacher_id = #{dto.teacherId}
  147. </if>
  148. <if test="dto.classId != null">
  149. AND t4.id = #{dto.classId}
  150. </if>
  151. </select>
  152. </mapper>