PaperquesMapper.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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.ie.mapper.PaperquesMapper">
  6. <resultMap type="Paperques" id="PaperquesResult">
  7. <result property="id" column="id" />
  8. <result property="paperId" column="paperId" />
  9. <result property="questionId" column="question_id" />
  10. <result property="sorces" column="sorces" />
  11. <result property="type" column="type" />
  12. </resultMap>
  13. <sql id="selectPaperquesVo">
  14. select id, paperId, question_id, sorces from paperques
  15. </sql>
  16. <select id="selectPaperquesList" parameterType="Paperques" resultMap="PaperquesResult">
  17. <include refid="selectPaperquesVo" />
  18. <where>
  19. <if test="paperId != null "> and paperId = #{paperId}</if>
  20. <if test="questionId != null "> and question_id = #{questionId}</if>
  21. <if test="sorces != null "> and sorces = #{sorces}</if>
  22. <if test="type != null and type != '' "> and type = #{type}</if>
  23. </where>
  24. </select>
  25. <select id="selectPaperquesById" parameterType="Long" resultMap="PaperquesResult">
  26. <include refid="selectPaperquesVo" />
  27. where id = #{id}
  28. </select>
  29. <insert id="insertPaperques" parameterType="Paperques" useGeneratedKeys="true" keyProperty="id">
  30. insert into paperques
  31. <trim prefix="(" suffix=")" suffixOverrides=",">
  32. <if test="paperId != null">paperId,</if>
  33. <if test="questionId != null">question_id,</if>
  34. <if test="sorces != null">sorces,</if>
  35. <if test="type != null">type,</if>
  36. </trim>
  37. <trim prefix="values (" suffix=")" suffixOverrides=",">
  38. <if test="paperId != null">#{paperId},</if>
  39. <if test="questionId != null">#{questionId},</if>
  40. <if test="sorces != null">#{sorces},</if>
  41. <if test="type != null">#{type},</if>
  42. </trim>
  43. </insert>
  44. <insert id="batchInsert" parameterType="Paperques" useGeneratedKeys="true" keyProperty="id">
  45. insert into paperques(paperId, question_id, sorces, type) VALUES
  46. <foreach collection="list" item="item" index="index" separator=",">
  47. (#{item.paperId}, #{item.questionId}, #{item.sorces}, #{item.type})
  48. </foreach>
  49. </insert>
  50. <update id="updatePaperques" parameterType="Paperques">
  51. update paperques
  52. <trim prefix="SET" suffixOverrides=",">
  53. <if test="paperId != null">paperId = #{paperId},</if>
  54. <if test="questionId != null">question_id = #{questionId},</if>
  55. <if test="sorces != null">sorces = #{sorces},</if>
  56. <if test="type != null">type = #{type},</if>
  57. </trim>
  58. where id = #{id}
  59. </update>
  60. <delete id="deletePaperquesById" parameterType="Long">
  61. delete from paperques where id = #{id}
  62. </delete>
  63. <delete id="deletePaperquesByIds" parameterType="String">
  64. delete from paperques where id in
  65. <foreach item="id" collection="array" open="(" separator="," close=")">
  66. #{id}
  67. </foreach>
  68. </delete>
  69. </mapper>