StuGoalInfoMapper.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.StuGoalInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.education.model.dto.StuGoalInfoRespDto">
  5. <id property="id" column="id"/>
  6. <result property="subjectId" column="subject_id"/>
  7. <result property="schoolType" column="school_type"/>
  8. <result property="courseSectionId" column="course_section_id"/>
  9. <result property="courseId" column="course_id"/>
  10. <result property="gradeId" column="grade_id"/>
  11. <result property="courseName" column="course_name"/>
  12. <result property="courseSectionName" column="course_section_name"/>
  13. <result property="content" column="content"/>
  14. <result property="gOriented" column="g_oriented"/>
  15. <result property="pScoreStd" column="p_score_std"/>
  16. <result property="sScoreStd" column="s_score_std"/>
  17. <result property="rScoreStd" column="r_score_std"/>
  18. <result property="eScoreStd" column="e_score_std"/>
  19. <result property="nScoreStd" column="n_score_std"/>
  20. <result property="createUser" column="create_user"/>
  21. <result property="knowPoints" column="know_points"/>
  22. <result property="publishFlag" column="publish_flag"/>
  23. <result property="createDate" column="create_date"/>
  24. <result property="updateDate" column="update_date"/>
  25. <result property="stuGoalInfoId" column="stu_goal_info_id"/>
  26. <result property="studentId" column="student_id"/>
  27. <result property="correctStatus" column="correct_status"/>
  28. <result property="pAnswer" column="p_answer"/>
  29. <result property="pScore" column="p_score"/>
  30. <result property="sAnswer" column="s_answer"/>
  31. <result property="sScore" column="s_score"/>
  32. <result property="rAnswer" column="r_answer"/>
  33. <result property="rScore" column="r_score"/>
  34. <result property="eAnswer" column="e_answer"/>
  35. <result property="eScore" column="e_score"/>
  36. <result property="nAnswer" column="n_answer"/>
  37. <result property="nScore" column="n_score"/>
  38. <result property="comment" column="comment"/>
  39. </resultMap>
  40. <!-- 学生导向目标答题记录列表 -->
  41. <select id="selectPageList" resultType="stuGoalInfoDto">
  42. select * from stu_goal_info
  43. <where>
  44. <if test="stuGoalInfo.studentId != null">
  45. and student_id = #{stuGoalInfo.studentId}
  46. </if>
  47. <if test="stuGoalInfo.homeworkInfoId != null">
  48. and homework_info_id = #{stuGoalInfo.homeworkInfoId}
  49. </if>
  50. <if test="stuGoalInfo.goalInfoId != null">
  51. and goal_info_id = #{stuGoalInfo.goalInfoId}
  52. </if>
  53. <if test="stuGoalInfo.correctStatus != null">
  54. and correct_status = #{stuGoalInfo.correctStatus}
  55. </if>
  56. </where>
  57. order by id desc
  58. </select>
  59. <!-- 根据 ID 查询学生导向目标答题记录 -->
  60. <select id="selectStuGoalInfoById" parameterType="int" resultType="com.education.model.entity.StuGoalInfo">
  61. SELECT * FROM stu_goal_info WHERE id = #{id}
  62. </select>
  63. <select id="selectPageByCourseId" resultType="com.education.model.dto.StuGoalInfoRespDto">
  64. select distinct goal_info.*,course_info.name as course_name,course_section.title AS course_section_name,
  65. l.id as stuGoalInfoId, l.student_id, l.correct_status,
  66. l.p_answer, l.p_score, l.s_answer, l.s_score, l.r_answer, l.r_score,
  67. l.e_answer, l.e_score, l.n_answer, l.n_score, l.comment
  68. from goal_info
  69. left join course_info
  70. on goal_info.course_id = course_info.id
  71. left join course_section
  72. ON goal_info.course_id = course_section.course_id AND goal_info.course_section_id = course_section.id
  73. left join (select a.* from stu_goal_info a,
  74. (select goal_info_id,max(id) as id from stu_goal_info where stu_goal_info.student_id = #{studentId} GROUP BY goal_info_id) AS b
  75. where a.id = b.id) as l
  76. on goal_info.id = l.goal_info_id
  77. <where>
  78. goal_info.course_id = #{courseId} and goal_info.publish_flag = 1
  79. </where>
  80. </select>
  81. <!-- 根据 ID 更新学生导向目标答题记录 -->
  82. <update id="updateStuGoalInfoById" parameterType="com.education.model.entity.StuGoalInfo">
  83. UPDATE stu_goal_info
  84. SET student_id = #{studentId},
  85. homework_info_id = #{homeworkInfoId},
  86. goal_info_id = #{goalInfoId},
  87. goal_mark = #{goalMark},
  88. correct_status = #{correctStatus},
  89. p_answer = #{pAnswer},
  90. p_score = #{pScore},
  91. s_answer = #{sAnswer},
  92. s_score = #{sScore},
  93. r_answer = #{rAnswer},
  94. r_score = #{rScore},
  95. e_answer = #{eAnswer},
  96. e_score = #{eScore},
  97. n_answer = #{nAnswer},
  98. n_score = #{nScore},
  99. comment = #{comment},
  100. create_date = #{createDate},
  101. update_date = #{updateDate}
  102. WHERE id = #{id}
  103. </update>
  104. <!-- 根据 ID 删除学生导向目标答题记录 -->
  105. <delete id="deleteStuGoalInfoById" parameterType="int">
  106. DELETE FROM stu_goal_info WHERE id = #{id}
  107. </delete>
  108. </mapper>