AssessmentTemplatePlanMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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.id 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
  60. and a2.stduy_status = t1.stduy_status AND a2.archives_status = 'FB2901') as submitted_count,
  61. (select count(*) from assessment_plan_answer_student a1
  62. left join base_student_school_roll a2 on a1.student_user_id = a2.user_id
  63. 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
  64. and a2.stduy_status = t1.stduy_status AND a2.archives_status = 'FB2901') as unsubmitted_count,
  65. (t4.teacher_id = #{dto.teacherId}) AS is_mine,t1.is_need_confirm FROM assessment_template_plan t1
  66. LEFT JOIN assessment_template t2 ON t1.assessment_template_id = t2.id
  67. LEFT JOIN assessment_plan_answer_class t3 ON t3.assessment_template_plan_id = t1.id
  68. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  69. WHERE t1.delete_mark = 0 AND t1.status in (1, 2)
  70. <if test="dto.teacherId != null and dto.isHeadTeacher != null and dto.isHeadTeacher == 1">
  71. AND t4.teacher_id = #{dto.teacherId}
  72. </if>
  73. <if test="dto.name != null and dto.name != ''">
  74. and t1.name like concat('%', #{dto.name}, '%')
  75. </if>
  76. <if test="dto.assessmentTemplateName != null and dto.assessmentTemplateName != ''">
  77. and t2.name like concat('%', #{dto.assessmentTemplateName}, '%')
  78. </if>
  79. <if test="dto.keyword != null and dto.keyword != ''">
  80. and (t2.name like concat('%', #{dto.keyword}, '%') or t1.name like concat('%', #{dto.keyword}, '%'))
  81. </if>
  82. <if test="dto.assessmentTemplateId != null">
  83. and t2.id = #{dto.assessmentTemplateId}
  84. </if>
  85. <if test="dto.assessmentTemplatePlanId != null">
  86. and t1.id = #{dto.assessmentTemplatePlanId}
  87. </if>
  88. <if test="dto.status != null">
  89. and t1.status = #{dto.status}
  90. </if>
  91. ORDER BY t1.create_date asc
  92. </select>
  93. <select id="getMobilePage" parameterType="com.xjrsoft.module.assessment.dto.AssessmentTemplatePlanPageDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentTemplatePlanPageVo">
  94. SELECT t1.id,t1.name,t1.score,t1.start_time,t1.status,t1.end_time,t2.name AS assessment_template_name,
  95. t1.assessment_template_id,
  96. (select count(*) from assessment_plan_answer_student a1
  97. left join base_student_school_roll a2 on a1.student_user_id = a2.user_id
  98. where a1.delete_mark = 0 and a1.assessment_template_plan_id = t1.id and a1.submit_status = 1
  99. and a2.stduy_status = t1.stduy_status AND a2.archives_status = 'FB2901') as submitted_count,
  100. (select count(*) from assessment_plan_answer_student a1
  101. left join base_student_school_roll a2 on a1.student_user_id = a2.user_id
  102. where a1.delete_mark = 0 and a1.assessment_template_plan_id = t1.id and (a1.submit_status = 0 OR a1.submit_status IS NULL)
  103. and a2.stduy_status = t1.stduy_status AND a2.archives_status = 'FB2901') as unsubmitted_count,
  104. (select count(*) from assessment_plan_answer_student a1
  105. left join base_student_school_roll a2 on a1.student_user_id = a2.user_id
  106. where a1.delete_mark = 0 and a1.assessment_template_plan_id = t1.id
  107. and a2.stduy_status = t1.stduy_status AND a2.archives_status = 'FB2901') AS allCount
  108. FROM assessment_template_plan t1
  109. LEFT JOIN assessment_template t2 ON t1.assessment_template_id = t2.id
  110. WHERE t1.delete_mark = 0 AND t1.status in (1, 2)
  111. <if test="dto.keyword != null and dto.keyword != ''">
  112. and t1.name like concat('%', #{dto.keyword}, '%')
  113. </if>
  114. ORDER BY t1.create_date asc
  115. </select>
  116. <select id="getAnswerStudent" parameterType="com.xjrsoft.module.assessment.dto.AssessmentPlanAnswerStudentDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerStudentVo">
  117. 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
  118. LEFT JOIN xjr_user t2 ON t1.student_user_id = t2.id
  119. LEFT JOIN base_student_school_roll t3 ON t1.student_user_id = t3.user_id
  120. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  121. WHERE t1.delete_mark = 0 AND t1.assessment_template_plan_id = #{dto.assessmentTemplatePlanId}
  122. and t1.submit_status = 1
  123. <if test="dto.keyword != null and dto.keyword != ''">
  124. and (t2.name like concat('%', #{dto.keyword}, '%') or t4.name like concat('%', #{dto.keyword}, '%'))
  125. </if>
  126. <if test="dto.name != null and dto.name != ''">
  127. and (t2.name like concat('%', #{dto.name}, '%') or t4.name like concat('%', #{dto.name}, '%'))
  128. </if>
  129. <if test="dto.teacherId != null">
  130. AND t4.teacher_id = #{dto.teacherId}
  131. </if>
  132. <if test="dto.classId != null">
  133. AND t4.id = #{dto.classId}
  134. </if>
  135. </select>
  136. <select id="getSemesterClass" resultType="java.lang.Long">
  137. SELECT distinct t1.class_id FROM assessment_plan_answer_class t1
  138. INNER JOIN assessment_template_plan t2 ON t1.assessment_template_plan_id = t2.id
  139. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0 AND t2.status in (0, 1) AND t2.base_semester_id = #{id}
  140. </select>
  141. <select id="getAnswerStudentList" parameterType="com.xjrsoft.module.assessment.dto.AssessmentPlanAnswerStudentDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerStudentVo">
  142. 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
  143. LEFT JOIN xjr_user t2 ON t1.student_user_id = t2.id
  144. LEFT JOIN base_student_school_roll t3 ON t1.student_user_id = t3.user_id
  145. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  146. WHERE t1.delete_mark = 0 AND t1.assessment_template_plan_id = #{dto.assessmentTemplatePlanId}
  147. <if test="dto.submitStatus != null and dto.submitStatus == 1">
  148. and t1.submit_status = 1
  149. </if>
  150. <if test="dto.keyword != null and dto.keyword != ''">
  151. and (t2.name like concat('%', #{dto.keyword}, '%') or t4.name like concat('%', #{dto.keyword}, '%'))
  152. </if>
  153. <if test="dto.name != null and dto.name != ''">
  154. and (t2.name like concat('%', #{dto.name}, '%') or t4.name like concat('%', #{dto.name}, '%'))
  155. </if>
  156. <if test="dto.teacherId != null">
  157. AND t4.teacher_id = #{dto.teacherId}
  158. </if>
  159. <if test="dto.classId != null">
  160. AND t4.id = #{dto.classId}
  161. </if>
  162. </select>
  163. </mapper>