LiveEventConfMapper.xml 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.LiveEventConfMapper">
  6. <resultMap type="LiveEventConf" id="LiveEventConfResult">
  7. <result property="eventId" column="event_id" />
  8. <result property="liveId" column="live_id" />
  9. <result property="eventType" column="event_type" />
  10. <result property="triggerCount" column="trigger_count" />
  11. <result property="redId" column="red_id" />
  12. <result property="createTime" column="create_time" />
  13. <result property="updateTime" column="update_time" />
  14. <result property="createBy" column="create_by" />
  15. <result property="updateBy" column="update_by" />
  16. </resultMap>
  17. <sql id="selectLiveEventConfVo">
  18. select event_id, live_id, event_type, trigger_count, red_id, create_time, update_time, create_by, update_by from live_event_conf
  19. </sql>
  20. <select id="selectLiveEventConfList" parameterType="LiveEventConf" resultMap="LiveEventConfResult">
  21. <include refid="selectLiveEventConfVo"/>
  22. <where>
  23. <if test="liveId != null "> and live_id = #{liveId}</if>
  24. <if test="eventType != null "> and event_type = #{eventType}</if>
  25. <if test="triggerCount != null "> and trigger_count = #{triggerCount}</if>
  26. </where>
  27. </select>
  28. <select id="selectLiveEventConfByEventId" parameterType="Long" resultMap="LiveEventConfResult">
  29. <include refid="selectLiveEventConfVo"/>
  30. where event_id = #{eventId}
  31. </select>
  32. <insert id="insertLiveEventConf" parameterType="LiveEventConf" useGeneratedKeys="true" keyProperty="eventId">
  33. insert into live_event_conf
  34. <trim prefix="(" suffix=")" suffixOverrides=",">
  35. <if test="liveId != null">live_id,</if>
  36. <if test="eventType != null">event_type,</if>
  37. <if test="triggerCount != null">trigger_count,</if>
  38. <if test="redId != null">red_id,</if>
  39. <if test="createTime != null">create_time,</if>
  40. <if test="updateTime != null">update_time,</if>
  41. <if test="createBy != null">create_by,</if>
  42. <if test="updateBy != null">update_by,</if>
  43. </trim>
  44. <trim prefix="values (" suffix=")" suffixOverrides=",">
  45. <if test="liveId != null">#{liveId},</if>
  46. <if test="eventType != null">#{eventType},</if>
  47. <if test="triggerCount != null">#{triggerCount},</if>
  48. <if test="redId != null">#{redId},</if>
  49. <if test="createTime != null">#{createTime},</if>
  50. <if test="updateTime != null">#{updateTime},</if>
  51. <if test="createBy != null">#{createBy},</if>
  52. <if test="updateBy != null">#{updateBy},</if>
  53. </trim>
  54. </insert>
  55. <update id="updateLiveEventConf" parameterType="LiveEventConf">
  56. update live_event_conf
  57. <trim prefix="SET" suffixOverrides=",">
  58. <if test="liveId != null">live_id = #{liveId},</if>
  59. <if test="eventType != null">event_type = #{eventType},</if>
  60. <if test="triggerCount != null">trigger_count = #{triggerCount},</if>
  61. <if test="redId != null">red_id = #{redId},</if>
  62. <if test="createTime != null">create_time = #{createTime},</if>
  63. <if test="updateTime != null">update_time = #{updateTime},</if>
  64. <if test="createBy != null">create_by = #{createBy},</if>
  65. <if test="updateBy != null">update_by = #{updateBy},</if>
  66. </trim>
  67. where event_id = #{eventId}
  68. </update>
  69. <delete id="deleteLiveEventConfByEventId" parameterType="Long">
  70. delete from live_event_conf where event_id = #{eventId}
  71. </delete>
  72. <delete id="deleteLiveEventConfByEventIds" parameterType="String">
  73. delete from live_event_conf where event_id in
  74. <foreach item="eventId" collection="array" open="(" separator="," close=")">
  75. #{eventId}
  76. </foreach>
  77. </delete>
  78. </mapper>