LearnPlanMapper.xml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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.LearnPlanMapper">
  6. <resultMap type="LearnPlan" id="LearnPlanResult">
  7. <result property="id" column="id" />
  8. <result property="studentId" column="studentId" />
  9. <result property="videoTime" column="video_time" />
  10. <result property="questionCnt" column="question_cnt" />
  11. <result property="status" column="status" />
  12. <result property="beginTime" column="begin_time" />
  13. <result property="createTime" column="create_time" />
  14. <result property="stats" column="stats" />
  15. </resultMap>
  16. <sql id="selectLearnPlanVo">
  17. select id, studentId, video_time, question_cnt, status, begin_time, create_time, stats from learn_plan
  18. </sql>
  19. <select id="selectLearnPlanList" parameterType="LearnPlan" resultMap="LearnPlanResult">
  20. <include refid="selectLearnPlanVo"/>
  21. <where>
  22. <if test="studentId != null "> and studentId = #{studentId}</if>
  23. <if test="videoTime != null "> and video_time = #{videoTime}</if>
  24. <if test="questionCnt != null "> and question_cnt = #{questionCnt}</if>
  25. <if test="status != null "> and status = #{status}</if>
  26. <if test="beginTime != null "> and begin_time = #{beginTime}</if>
  27. <if test="stats != null and stats != ''"> and stats = #{stats}</if>
  28. </where>
  29. </select>
  30. <select id="selectLearnPlanById" parameterType="String" resultMap="LearnPlanResult">
  31. <include refid="selectLearnPlanVo"/>
  32. where id = #{id}
  33. </select>
  34. <insert id="insertLearnPlan" parameterType="LearnPlan" useGeneratedKeys="true" keyProperty="id">
  35. insert into learn_plan
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="studentId != null">studentId,</if>
  38. <if test="videoTime != null">video_time,</if>
  39. <if test="questionCnt != null">question_cnt,</if>
  40. <if test="status != null">status,</if>
  41. <if test="beginTime != null">begin_time,</if>
  42. <if test="createTime != null">create_time,</if>
  43. <if test="stats != null">stats,</if>
  44. </trim>
  45. <trim prefix="values (" suffix=")" suffixOverrides=",">
  46. <if test="studentId != null">#{studentId},</if>
  47. <if test="videoTime != null">#{videoTime},</if>
  48. <if test="questionCnt != null">#{questionCnt},</if>
  49. <if test="status != null">#{status},</if>
  50. <if test="beginTime != null">#{beginTime},</if>
  51. <if test="createTime != null">#{createTime},</if>
  52. <if test="stats != null">#{stats},</if>
  53. </trim>
  54. </insert>
  55. <update id="updateLearnPlan" parameterType="LearnPlan">
  56. update learn_plan
  57. <trim prefix="SET" suffixOverrides=",">
  58. <if test="studentId != null">studentId = #{studentId},</if>
  59. <if test="videoTime != null">video_time = #{videoTime},</if>
  60. <if test="questionCnt != null">question_cnt = #{questionCnt},</if>
  61. <if test="status != null">status = #{status},</if>
  62. <if test="beginTime != null">begin_time = #{beginTime},</if>
  63. <if test="createTime != null">create_time = #{createTime},</if>
  64. <if test="stats != null">stats = #{stats},</if>
  65. </trim>
  66. where id = #{id}
  67. </update>
  68. <delete id="deleteLearnPlanById" parameterType="String">
  69. delete from learn_plan where id = #{id}
  70. </delete>
  71. <delete id="deleteLearnPlanByIds" parameterType="String">
  72. delete from learn_plan where id in
  73. <foreach item="id" collection="array" open="(" separator="," close=")">
  74. #{id}
  75. </foreach>
  76. </delete>
  77. </mapper>