LiveQuestionMapper.xml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.fs.live.mapper.LiveQuestionMapper">
  6. <resultMap type="LiveQuestion" id="LiveQuestionResult">
  7. <result property="questionId" column="question_id" />
  8. <result property="userId" column="user_id" />
  9. <result property="question" column="question" />
  10. <result property="reply" column="reply" />
  11. <result property="replyTime" column="reply_time" />
  12. <result property="createTime" column="create_time" />
  13. <result property="createBy" column="create_by" />
  14. <result property="updateBy" column="update_by" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="remark" column="remark" />
  17. </resultMap>
  18. <sql id="selectLiveQuestionVo">
  19. select question_id, user_id, question, reply, reply_time, create_time, create_by, update_by, update_time, remark from live_question
  20. </sql>
  21. <select id="selectLiveQuestionList" parameterType="LiveQuestion" resultMap="LiveQuestionResult">
  22. <include refid="selectLiveQuestionVo"/>
  23. <where>
  24. <if test="userId != null "> and user_id = #{userId}</if>
  25. <if test="question != null and question != ''"> and question = #{question}</if>
  26. <if test="reply != null and reply != ''"> and reply = #{reply}</if>
  27. <if test="replyTime != null "> and reply_time = #{replyTime}</if>
  28. </where>
  29. </select>
  30. <select id="selectLiveQuestionByQuestionId" parameterType="Long" resultMap="LiveQuestionResult">
  31. <include refid="selectLiveQuestionVo"/>
  32. where question_id = #{questionId}
  33. </select>
  34. <insert id="insertLiveQuestion" parameterType="LiveQuestion" useGeneratedKeys="true" keyProperty="questionId">
  35. insert into live_question
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="userId != null">user_id,</if>
  38. <if test="question != null">question,</if>
  39. <if test="reply != null">reply,</if>
  40. <if test="replyTime != null">reply_time,</if>
  41. <if test="createTime != null">create_time,</if>
  42. <if test="createBy != null">create_by,</if>
  43. <if test="updateBy != null">update_by,</if>
  44. <if test="updateTime != null">update_time,</if>
  45. <if test="remark != null">remark,</if>
  46. </trim>
  47. <trim prefix="values (" suffix=")" suffixOverrides=",">
  48. <if test="userId != null">#{userId},</if>
  49. <if test="question != null">#{question},</if>
  50. <if test="reply != null">#{reply},</if>
  51. <if test="replyTime != null">#{replyTime},</if>
  52. <if test="createTime != null">#{createTime},</if>
  53. <if test="createBy != null">#{createBy},</if>
  54. <if test="updateBy != null">#{updateBy},</if>
  55. <if test="updateTime != null">#{updateTime},</if>
  56. <if test="remark != null">#{remark},</if>
  57. </trim>
  58. </insert>
  59. <update id="updateLiveQuestion" parameterType="LiveQuestion">
  60. update live_question
  61. <trim prefix="SET" suffixOverrides=",">
  62. <if test="userId != null">user_id = #{userId},</if>
  63. <if test="question != null">question = #{question},</if>
  64. <if test="reply != null">reply = #{reply},</if>
  65. <if test="replyTime != null">reply_time = #{replyTime},</if>
  66. <if test="createTime != null">create_time = #{createTime},</if>
  67. <if test="createBy != null">create_by = #{createBy},</if>
  68. <if test="updateBy != null">update_by = #{updateBy},</if>
  69. <if test="updateTime != null">update_time = #{updateTime},</if>
  70. <if test="remark != null">remark = #{remark},</if>
  71. </trim>
  72. where question_id = #{questionId}
  73. </update>
  74. <delete id="deleteLiveQuestionByQuestionId" parameterType="Long">
  75. delete from live_question where question_id = #{questionId}
  76. </delete>
  77. <delete id="deleteLiveQuestionByQuestionIds" parameterType="String">
  78. delete from live_question where question_id in
  79. <foreach item="questionId" collection="array" open="(" separator="," close=")">
  80. #{questionId}
  81. </foreach>
  82. </delete>
  83. </mapper>