LearnKnowledgeQuestionMapper.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.LearnKnowledgeQuestionMapper">
  6. <resultMap type="LearnKnowledgeQuestion" id="LearnKnowledgeQuestionResult">
  7. <result property="id" column="id" />
  8. <result property="knowledgeId" column="knowledge_id" />
  9. <result property="type" column="type" />
  10. <result property="questionId" column="question_id" />
  11. <result property="seq" column="seq" />
  12. <result property="createTime" column="create_time" />
  13. </resultMap>
  14. <sql id="selectLearnKnowledgeQuestionVo">
  15. select id, knowledge_id, type, question_id, seq, create_time from learn_knowledge_question
  16. </sql>
  17. <select id="selectLearnKnowledgeQuestionList" parameterType="LearnKnowledgeQuestion" resultMap="LearnKnowledgeQuestionResult">
  18. <include refid="selectLearnKnowledgeQuestionVo"/>
  19. <where>
  20. <if test="knowledgeId != null "> and knowledge_id = #{knowledgeId}</if>
  21. <if test="type != null "> and type = #{type}</if>
  22. <if test="questionId != null "> and question_id = #{questionId}</if>
  23. <if test="seq != null "> and seq = #{seq}</if>
  24. </where>
  25. </select>
  26. <select id="selectLearnKnowledgeQuestionById" parameterType="Long" resultMap="LearnKnowledgeQuestionResult">
  27. <include refid="selectLearnKnowledgeQuestionVo"/>
  28. where id = #{id}
  29. </select>
  30. <insert id="insertLearnKnowledgeQuestion" parameterType="LearnKnowledgeQuestion" useGeneratedKeys="true" keyProperty="id">
  31. insert into learn_knowledge_question
  32. <trim prefix="(" suffix=")" suffixOverrides=",">
  33. <if test="knowledgeId != null">knowledge_id,</if>
  34. <if test="type != null">type,</if>
  35. <if test="questionId != null">question_id,</if>
  36. <if test="seq != null">seq,</if>
  37. <if test="createTime != null">create_time,</if>
  38. </trim>
  39. <trim prefix="values (" suffix=")" suffixOverrides=",">
  40. <if test="knowledgeId != null">#{knowledgeId},</if>
  41. <if test="type != null">#{type},</if>
  42. <if test="questionId != null">#{questionId},</if>
  43. <if test="seq != null">#{seq},</if>
  44. <if test="createTime != null">#{createTime},</if>
  45. </trim>
  46. </insert>
  47. <update id="updateLearnKnowledgeQuestion" parameterType="LearnKnowledgeQuestion">
  48. update learn_knowledge_question
  49. <trim prefix="SET" suffixOverrides=",">
  50. <if test="knowledgeId != null">knowledge_id = #{knowledgeId},</if>
  51. <if test="type != null">type = #{type},</if>
  52. <if test="questionId != null">question_id = #{questionId},</if>
  53. <if test="seq != null">seq = #{seq},</if>
  54. <if test="createTime != null">create_time = #{createTime},</if>
  55. </trim>
  56. where id = #{id}
  57. </update>
  58. <delete id="deleteLearnKnowledgeQuestionById" parameterType="Long">
  59. delete from learn_knowledge_question where id = #{id}
  60. </delete>
  61. <delete id="deleteLearnKnowledgeQuestionByIds" parameterType="String">
  62. delete from learn_knowledge_question where id in
  63. <foreach item="id" collection="array" open="(" separator="," close=")">
  64. #{id}
  65. </foreach>
  66. </delete>
  67. <select id="selectByQuestionIds" resultMap="LearnKnowledgeQuestionResult">
  68. <include refid="selectLearnKnowledgeQuestionVo"/>
  69. WHERE question_id IN
  70. <foreach item="questionId" collection="questionIds" open="(" separator="," close=")">
  71. #{questionId}
  72. </foreach>
  73. </select>
  74. </mapper>