AssessmentTemplatePlanMapper.xml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. WHERE t1.delete_mark = 0 AND t1.status = 1 AND t3.student_user_id = #{dto.studentUserId}
  34. and t3.is_confirm = 1
  35. <if test="dto.name != null and dto.name != ''">
  36. and t1.name like concat('%', #{dto.name}, '%')
  37. </if>
  38. <if test="dto.assessmentTemplateName != null and dto.assessmentTemplateName != ''">
  39. and t2.name like concat('%', #{dto.assessmentTemplateName}, '%')
  40. </if>
  41. <if test="dto.keyword != null and dto.keyword != ''">
  42. and (t2.name like concat('%', #{dto.keyword}, '%') or t1.name like concat('%', #{dto.keyword}, '%'))
  43. </if>
  44. <if test="dto.assessmentTemplateId != null">
  45. and t2.id = #{dto.assessmentTemplateId}
  46. </if>
  47. <if test="dto.status != null">
  48. and t1.status = #{dto.status}
  49. </if>
  50. ORDER BY t1.create_date asc
  51. </select>
  52. <select id="getTeacherPage" parameterType="com.xjrsoft.module.assessment.dto.AssessmentPlanAnswerPageDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerTeacherPageVo">
  53. SELECT t1.id,t1.name,t1.score,t1.start_time,t1.status,t1.end_time,t2.name AS assessment_template_name,
  54. t1.assessment_template_id,t3.is_confirm,t3.class_id,t4.name as class_name,
  55. (select count(*) from assessment_plan_answer_student a1
  56. left join base_student_school_roll a2 on a1.student_user_id = a2.user_id
  57. 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,
  58. (select count(*) from assessment_plan_answer_student a1
  59. left join base_student_school_roll a2 on a1.student_user_id = a2.user_id
  60. 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 FROM assessment_template_plan t1
  61. LEFT JOIN assessment_template t2 ON t1.assessment_template_id = t2.id
  62. LEFT JOIN assessment_plan_answer_class t3 ON t3.assessment_template_plan_id = t1.id
  63. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  64. WHERE t1.delete_mark = 0 AND t1.status = 1
  65. <if test="dto.teacherId != null">
  66. AND t4.teacher_id = #{dto.teacherId}
  67. </if>
  68. <if test="dto.name != null and dto.name != ''">
  69. and t1.name like concat('%', #{dto.name}, '%')
  70. </if>
  71. <if test="dto.assessmentTemplateName != null and dto.assessmentTemplateName != ''">
  72. and t2.name like concat('%', #{dto.assessmentTemplateName}, '%')
  73. </if>
  74. <if test="dto.keyword != null and dto.keyword != ''">
  75. and (t2.name like concat('%', #{dto.keyword}, '%') or t1.name like concat('%', #{dto.keyword}, '%'))
  76. </if>
  77. <if test="dto.assessmentTemplateId != null">
  78. and t2.id = #{dto.assessmentTemplateId}
  79. </if>
  80. <if test="dto.assessmentTemplatePlanId != null">
  81. and t1.id = #{dto.assessmentTemplatePlanId}
  82. </if>
  83. <if test="dto.status != null">
  84. and t1.status = #{dto.status}
  85. </if>
  86. ORDER BY t1.create_date asc
  87. </select>
  88. <select id="getMobilePage" parameterType="com.xjrsoft.module.assessment.dto.AssessmentTemplatePlanPageDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentTemplatePlanPageVo">
  89. SELECT t1.id,t1.name,t1.score,t1.start_time,t1.status,t1.end_time,t2.name AS assessment_template_name,
  90. t1.assessment_template_id,
  91. (SELECT COUNT(*) FROM assessment_plan_answer_student WHERE delete_mark = 0 AND assessment_template_plan_id = t1.id AND submit_status = 1) AS submittedCount,
  92. (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,
  93. (SELECT COUNT(*) FROM assessment_plan_answer_student WHERE delete_mark = 0 AND assessment_template_plan_id = t1.id) AS allCount
  94. FROM assessment_template_plan t1
  95. LEFT JOIN assessment_template t2 ON t1.assessment_template_id = t2.id
  96. WHERE t1.delete_mark = 0 AND t1.status = 1
  97. <if test="dto.keyword != null and dto.keyword != ''">
  98. and t1.name like concat('%', #{dto.keyword}, '%')
  99. </if>
  100. ORDER BY t1.create_date asc
  101. </select>
  102. <select id="getAnswerStudent" parameterType="com.xjrsoft.module.assessment.dto.AssessmentPlanAnswerStudentDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerStudentVo">
  103. SELECT t1.student_user_id,t2.name,t1.submit_status,t1.assessment_template_plan_id FROM assessment_plan_answer_student t1
  104. LEFT JOIN xjr_user t2 ON t1.student_user_id = t2.id
  105. LEFT JOIN base_student_school_roll t3 ON t1.student_user_id = t3.user_id
  106. LEFT JOIN base_class t4 ON t3.class_id = t4.id
  107. WHERE t1.delete_mark = 0 AND t1.assessment_template_plan_id = #{dto.assessmentTemplatePlanId}
  108. <if test="dto.keyword != null and dto.keyword != ''">
  109. and t2.name like concat('%', #{dto.keyword}, '%')
  110. </if>
  111. <if test="dto.teacherId != null">
  112. AND t4.teacher_id = #{dto.teacherId}
  113. </if>
  114. </select>
  115. <select id="getSemesterClass" resultType="java.lang.Long">
  116. SELECT distinct t1.class_id FROM assessment_plan_answer_class t1
  117. INNER JOIN assessment_template_plan t2 ON t1.assessment_template_plan_id = t2.id
  118. WHERE t1.delete_mark = 0 AND t2.delete_mark = 0 AND t2.status in (0, 1) AND t2.base_semester_id = #{id}
  119. </select>
  120. </mapper>