LearnStudentMapper.xml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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.ruoyi.learn.mapper.LearnStudentMapper">
  6. <resultMap type="LearnStudent" id="LearnStudentResult">
  7. <result property="studentId" column="student_id" />
  8. <result property="directKey" column="direct_key" />
  9. </resultMap>
  10. <sql id="selectLearnStudentVo">
  11. select student_id, direct_key from learn_student
  12. </sql>
  13. <select id="selectLearnStudentList" parameterType="LearnStudent" resultMap="LearnStudentResult">
  14. <include refid="selectLearnStudentVo"/>
  15. <where>
  16. <if test="directKey != null and directKey != ''"> and direct_key = #{directKey}</if>
  17. </where>
  18. </select>
  19. <select id="selectLearnStudentByStudentId" parameterType="Long" resultMap="LearnStudentResult">
  20. <include refid="selectLearnStudentVo"/>
  21. where student_id = #{studentId}
  22. </select>
  23. <insert id="insertLearnStudent" parameterType="LearnStudent">
  24. insert into learn_student
  25. <trim prefix="(" suffix=")" suffixOverrides=",">
  26. <if test="studentId != null">student_id,</if>
  27. <if test="directKey != null">direct_key,</if>
  28. </trim>
  29. <trim prefix="values (" suffix=")" suffixOverrides=",">
  30. <if test="studentId != null">#{studentId},</if>
  31. <if test="directKey != null">#{directKey},</if>
  32. </trim>
  33. </insert>
  34. <update id="updateLearnStudent" parameterType="LearnStudent">
  35. update learn_student
  36. <trim prefix="SET" suffixOverrides=",">
  37. <if test="directKey != null">direct_key = #{directKey},</if>
  38. </trim>
  39. where student_id = #{studentId}
  40. </update>
  41. <delete id="deleteLearnStudentByStudentId" parameterType="Long">
  42. delete from learn_student where student_id = #{studentId}
  43. </delete>
  44. <delete id="deleteLearnStudentByStudentIds" parameterType="String">
  45. delete from learn_student where student_id in
  46. <foreach item="studentId" collection="array" open="(" separator="," close=")">
  47. #{studentId}
  48. </foreach>
  49. </delete>
  50. </mapper>