StudentInfoMapper.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.education.business.mapper.education.StudentInfoMapper">
  4. <!-- 学员列表 -->
  5. <select id="selectPageList" resultType="studentInfoDto">
  6. select student.*, grade.name grade_name from student_info student left join grade_info grade
  7. on student.grade_info_id = grade.id
  8. <where>
  9. <if test="studentInfo.gradeInfoId != null">
  10. and student.grade_info_id = #{studentInfo.gradeInfoId}
  11. </if>
  12. <if test="studentInfo.name != null and studentInfo.name != ''">
  13. <bind name="name" value="'%' + studentInfo.name + '%'"/>
  14. and student.name like #{name} or student.mobile like #{name}
  15. </if>
  16. </where>
  17. order by student.id desc
  18. </select>
  19. <select id="selectById" resultType="com.education.model.dto.StudentInfoDto">
  20. SELECT
  21. si.*,
  22. CONCAT(
  23. ROUND(
  24. (
  25. SELECT COUNT(DISTINCT sgi.goal_info_id)
  26. FROM stu_goal_info sgi
  27. WHERE sgi.student_id = si.id AND sgi.correct_status >= 2
  28. ) / NULLIF(
  29. (
  30. SELECT COUNT( gi.id)
  31. FROM student_course_collect scc
  32. JOIN goal_info gi ON scc.course_id = gi.course_id
  33. WHERE scc.student_id = si.id AND gi.publish_flag = 1
  34. ), 0
  35. ) * 100, 2
  36. ), '%'
  37. ) AS progress
  38. FROM
  39. student_info si
  40. WHERE
  41. si.id = #{id}
  42. </select>
  43. <!-- 提醒列表 -->
  44. <select id="selectStudentRemindList" resultType="goalInfo">
  45. SELECT
  46. goal.*
  47. FROM
  48. goal_info goal
  49. WHERE
  50. goal.publish_flag >0 AND (
  51. NOT EXISTS ( SELECT 1 FROM stu_goal_info sgi WHERE sgi.student_id = #{studentId} AND sgi.goal_info_id = goal.id )
  52. OR (
  53. EXISTS ( SELECT 1 FROM stu_goal_info sg WHERE sg.student_id = #{studentId} AND sg.goal_info_id = goal.id AND sg.correct_status &lt; 2 )
  54. AND NOT EXISTS ( SELECT 1 FROM stu_goal_info si WHERE si.student_id = #{studentId} AND si.goal_info_id = goal.id AND si.correct_status >= 2 )))
  55. ORDER BY goal.id
  56. </select>
  57. <!-- 学习记录列表 -->
  58. <select id="selectStudyHistoryPageList" resultType="com.education.model.dto.StuGoalInfoDto">
  59. select student.student_id as studentId, student.create_date as createDate,
  60. student.goal_info_id as goalInfoId, course.id as courseId, course.name as courseName,
  61. goal.g_oriented as goalContent
  62. from stu_goal_info student
  63. left join goal_info goal on student.goal_info_id = goal.id
  64. left join course_info course on goal.course_id = course.id
  65. <where>
  66. <if test="stuGoalInfoDto.studentId != null">
  67. and student.student_id = #{stuGoalInfoDto.studentId}
  68. </if>
  69. <if test="stuGoalInfoDto.goalInfoId != null">
  70. and goal.id = #{stuGoalInfoDto.goalInfoId}
  71. </if>
  72. <if test="stuGoalInfoDto.createDate != null and stuGoalInfoDto.createDate != ''">
  73. AND student.create_date BETWEEN #{stuGoalInfoDto.startDate} AND #{stuGoalInfoDto.endDate}
  74. </if>
  75. </where>
  76. order by student.goal_info_id
  77. </select>
  78. </mapper>