LiveLotteryRegistrationMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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.LiveLotteryRegistrationMapper">
  6. <resultMap type="LiveLotteryRegistration" id="LiveLotteryRegistrationResult">
  7. <result property="registrationId" column="registration_id" />
  8. <result property="liveId" column="live_id" />
  9. <result property="userId" column="user_id" />
  10. <result property="lotteryId" column="lottery_id" />
  11. <result property="isWin" column="is_win" />
  12. <result property="rizeLevel" column="rize_level" />
  13. <result property="createTime" column="create_time" />
  14. <result property="updateTime" column="update_time" />
  15. <result property="createBy" column="create_by" />
  16. <result property="updateBy" column="update_by" />
  17. </resultMap>
  18. <sql id="selectLiveLotteryRegistrationVo">
  19. select registration_id, live_id, user_id, lottery_id, is_win, rize_level, create_time, update_time, create_by, update_by from live_lottery_registration
  20. </sql>
  21. <select id="selectLiveLotteryRegistrationList" parameterType="LiveLotteryRegistration" resultMap="LiveLotteryRegistrationResult">
  22. <include refid="selectLiveLotteryRegistrationVo"/>
  23. <where>
  24. </where>
  25. </select>
  26. <select id="selectLiveLotteryRegistrationByRegistrationId" parameterType="Long" resultMap="LiveLotteryRegistrationResult">
  27. <include refid="selectLiveLotteryRegistrationVo"/>
  28. where registration_id = #{registrationId}
  29. </select>
  30. <insert id="insertLiveLotteryRegistration" parameterType="LiveLotteryRegistration" useGeneratedKeys="true" keyProperty="registrationId">
  31. insert into live_lottery_registration
  32. <trim prefix="(" suffix=")" suffixOverrides=",">
  33. <if test="liveId != null">live_id,</if>
  34. <if test="userId != null">user_id,</if>
  35. <if test="lotteryId != null">lottery_id,</if>
  36. <if test="isWin != null">is_win,</if>
  37. <if test="rizeLevel != null">rize_level,</if>
  38. <if test="createTime != null">create_time,</if>
  39. <if test="updateTime != null">update_time,</if>
  40. <if test="createBy != null">create_by,</if>
  41. <if test="updateBy != null">update_by,</if>
  42. </trim>
  43. <trim prefix="values (" suffix=")" suffixOverrides=",">
  44. <if test="liveId != null">#{liveId},</if>
  45. <if test="userId != null">#{userId},</if>
  46. <if test="lotteryId != null">#{lotteryId},</if>
  47. <if test="isWin != null">#{isWin},</if>
  48. <if test="rizeLevel != null">#{rizeLevel},</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. <!-- 批量插入抽奖注册记录 -->
  56. <insert id="insertLiveLotteryRegistrationBatch" parameterType="java.util.List">
  57. INSERT INTO live_lottery_registration (
  58. live_id,
  59. user_id,
  60. lottery_id,
  61. is_win,
  62. rize_level,
  63. create_time,
  64. update_time,
  65. create_by,
  66. update_by
  67. ) VALUES
  68. <foreach collection="list" item="item" separator=",">
  69. (
  70. #{item.liveId},
  71. #{item.userId},
  72. #{item.lotteryId},
  73. #{item.isWin},
  74. #{item.rizeLevel},
  75. #{item.createTime},
  76. #{item.updateTime},
  77. #{item.createBy},
  78. #{item.updateBy}
  79. )
  80. </foreach>
  81. </insert>
  82. <update id="updateLiveLotteryRegistration" parameterType="LiveLotteryRegistration">
  83. update live_lottery_registration
  84. <trim prefix="SET" suffixOverrides=",">
  85. <if test="liveId != null">live_id = #{liveId},</if>
  86. <if test="userId != null">user_id = #{userId},</if>
  87. <if test="lotteryId != null">lottery_id = #{lotteryId},</if>
  88. <if test="isWin != null">is_win = #{isWin},</if>
  89. <if test="rizeLevel != null">rize_level = #{rizeLevel},</if>
  90. <if test="createTime != null">create_time = #{createTime},</if>
  91. <if test="updateTime != null">update_time = #{updateTime},</if>
  92. <if test="createBy != null">create_by = #{createBy},</if>
  93. <if test="updateBy != null">update_by = #{updateBy},</if>
  94. </trim>
  95. where registration_id = #{registrationId}
  96. </update>
  97. <update id="updateLiveLotteryRegistrationNoId" parameterType="LiveLotteryRegistration">
  98. update live_lottery_registration
  99. <trim prefix="SET" suffixOverrides=",">
  100. <if test="liveId != null">live_id = #{liveId},</if>
  101. <if test="userId != null">user_id = #{userId},</if>
  102. <if test="lotteryId != null">lottery_id = #{lotteryId},</if>
  103. <if test="isWin != null">is_win = #{isWin},</if>
  104. <if test="rizeLevel != null">rize_level = #{rizeLevel},</if>
  105. <if test="createTime != null">create_time = #{createTime},</if>
  106. <if test="updateTime != null">update_time = #{updateTime},</if>
  107. <if test="createBy != null">create_by = #{createBy},</if>
  108. <if test="updateBy != null">update_by = #{updateBy},</if>
  109. </trim>
  110. where live_id = #{liveId} and user_id = #{userId} and lottery_id = #{lotteryId}
  111. </update>
  112. <delete id="deleteLiveLotteryRegistrationByRegistrationId" parameterType="Long">
  113. delete from live_lottery_registration where registration_id = #{registrationId}
  114. </delete>
  115. <delete id="deleteLiveLotteryRegistrationByRegistrationIds" parameterType="String">
  116. delete from live_lottery_registration where registration_id in
  117. <foreach item="registrationId" collection="array" open="(" separator="," close=")">
  118. #{registrationId}
  119. </foreach>
  120. </delete>
  121. </mapper>