AssessmentPlanAnswerResultMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.AssessmentPlanAnswerResultMapper">
  6. <select id="getResultList" parameterType="com.xjrsoft.module.assessment.dto.AssessmentQuestionResultDto" resultType="com.xjrsoft.module.assessment.vo.AssessmentQuestionResultVo">
  7. SELECT question_id,GROUP_CONCAT(answer_id) as answer FROM assessment_plan_answer_result
  8. WHERE assessment_template_plan_id = #{dto.assessmentTemplatePlanId} AND student_user_id = #{dto.userId} GROUP BY question_id
  9. </select>
  10. <select id="getClassResult" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerClassResultVo">
  11. SELECT t2.name AS class_name,
  12. (SELECT COUNT(a1.id) FROM assessment_plan_answer_student a1
  13. INNER JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id WHERE a2.class_id = t1.class_id
  14. AND a1.assessment_template_plan_id = t1.assessment_template_plan_id) AS student_count,
  15. (SELECT COUNT(a1.id) FROM assessment_plan_answer_student a1
  16. INNER JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id WHERE a2.class_id = t1.class_id AND a1.submit_status = 1
  17. AND a1.assessment_template_plan_id = t1.assessment_template_plan_id) submitted_count,
  18. (SELECT COUNT(a1.id) FROM assessment_plan_answer_student a1
  19. INNER JOIN base_student_school_roll a2 ON a1.student_user_id = a2.user_id WHERE a2.class_id = t1.class_id
  20. AND a1.assessment_template_plan_id = t1.assessment_template_plan_id AND (a1.submit_status = 0 OR a1.submit_status IS NULL)) AS unsubmitted_count
  21. FROM assessment_plan_answer_class t1
  22. LEFT JOIN base_class t2 ON t1.class_id = t2.id
  23. WHERE t1.delete_mark = 0 AND t1.assessment_template_plan_id = #{id}
  24. order by t2.name
  25. </select>
  26. <select id="getQuestionResult" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerDetailVo">
  27. SELECT question_id,answer_id,COUNT(*) AS choose_count FROM assessment_plan_answer_result WHERE delete_mark = 0 AND assessment_template_plan_id = #{id}
  28. GROUP BY question_id,answer_id
  29. </select>
  30. <select id="getScaleQuestionResult" resultType="com.xjrsoft.module.assessment.vo.AssessmentPlanAnswerDetailVo">
  31. SELECT t1.question_id,t1.answer_id,COUNT(t1.id) AS choose_count FROM assessment_plan_answer_result t1
  32. INNER JOIN assessment_plan_question t2 ON t1.question_id = t2.id
  33. WHERE t1.delete_mark = 0 AND t1.assessment_template_plan_id = #{id}
  34. AND t2.type = 'scale_question'
  35. GROUP BY t1.question_id,t1.answer_id
  36. </select>
  37. </mapper>