WeekStarGiftMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.juxiao.xchat.module.xbd.mapper.activity.WeekStarGiftMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.activity.WeekStarGift" >
  5. <id column="id" property="id" jdbcType="BIGINT" />
  6. <result column="status" property="status" jdbcType="INTEGER" />
  7. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  8. <result column="gift_id" property="giftId" jdbcType="INTEGER" />
  9. <result column="admin_id" property="adminId" jdbcType="INTEGER" />
  10. <result column="seq" property="seq" jdbcType="INTEGER" />
  11. <result column="type" property="type" jdbcType="INTEGER" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. id, status, create_time, gift_id, admin_id, seq,type
  15. </sql>
  16. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  17. select
  18. <include refid="Base_Column_List" />
  19. from week_star_gift
  20. where id = #{id,jdbcType=BIGINT}
  21. </select>
  22. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.activity.WeekStarGift" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  23. insert into week_star_gift (id, status, create_time,
  24. gift_id, admin_id, seq,type
  25. )
  26. values (#{id,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
  27. #{giftId,jdbcType=INTEGER}, #{adminId,jdbcType=INTEGER}, #{seq,jdbcType=INTEGER},#{type,jdbcType=INTEGER}
  28. )
  29. </insert>
  30. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.activity.WeekStarGift" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  31. insert into week_star_gift
  32. <trim prefix="(" suffix=")" suffixOverrides="," >
  33. <if test="id != null" >
  34. id,
  35. </if>
  36. <if test="status != null" >
  37. status,
  38. </if>
  39. <if test="createTime != null" >
  40. create_time,
  41. </if>
  42. <if test="giftId != null" >
  43. gift_id,
  44. </if>
  45. <if test="adminId != null" >
  46. admin_id,
  47. </if>
  48. <if test="seq != null" >
  49. seq,
  50. </if>
  51. <if test="type != null" >
  52. type,
  53. </if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides="," >
  56. <if test="id != null" >
  57. #{id,jdbcType=BIGINT},
  58. </if>
  59. <if test="status != null" >
  60. #{status,jdbcType=INTEGER},
  61. </if>
  62. <if test="createTime != null" >
  63. #{createTime,jdbcType=TIMESTAMP},
  64. </if>
  65. <if test="giftId != null" >
  66. #{giftId,jdbcType=INTEGER},
  67. </if>
  68. <if test="adminId != null" >
  69. #{adminId,jdbcType=INTEGER},
  70. </if>
  71. <if test="seq != null" >
  72. #{seq,jdbcType=INTEGER},
  73. </if>
  74. <if test="type != null" >
  75. #{type,jdbcType=INTEGER},
  76. </if>
  77. </trim>
  78. </insert>
  79. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.activity.WeekStarGift" >
  80. update week_star_gift
  81. <set >
  82. <if test="status != null" >
  83. status = #{status,jdbcType=INTEGER},
  84. </if>
  85. <if test="createTime != null" >
  86. create_time = #{createTime,jdbcType=TIMESTAMP},
  87. </if>
  88. <if test="giftId != null" >
  89. gift_id = #{giftId,jdbcType=INTEGER},
  90. </if>
  91. <if test="adminId != null" >
  92. admin_id = #{adminId,jdbcType=INTEGER},
  93. </if>
  94. <if test="seq != null" >
  95. seq = #{seq,jdbcType=INTEGER},
  96. </if>
  97. <if test="type != null" >
  98. type = #{type,jdbcType=INTEGER},
  99. </if>
  100. </set>
  101. where id = #{id,jdbcType=BIGINT}
  102. </update>
  103. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.activity.WeekStarGift" >
  104. update week_star_gift
  105. set status = #{status,jdbcType=INTEGER},
  106. create_time = #{createTime,jdbcType=TIMESTAMP},
  107. gift_id = #{giftId,jdbcType=INTEGER},
  108. admin_id = #{adminId,jdbcType=INTEGER},
  109. seq = #{seq,jdbcType=INTEGER},
  110. type = #{type,jdbcType=INTEGER}
  111. where id = #{id,jdbcType=BIGINT}
  112. </update>
  113. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  114. delete from week_star_gift
  115. where id = #{id,jdbcType=BIGINT}
  116. </delete>
  117. <select id="selectByGiftId" resultType="com.juxiao.xchat.module.xbd.domain.activity.WeekStarGift">
  118. select id,status,create_time as createTime,gift_id as giftId,admin_id as adminId,seq,type
  119. from week_star_gift
  120. where status = 1 and gift_id = #{giftId}
  121. </select>
  122. <select id="selectByList" resultType="com.juxiao.xchat.module.xbd.vo.WeekStarGiftVO">
  123. select id,status,create_time as createTime,gift_id as giftId,admin_id as adminId,seq ,type
  124. from week_star_gift
  125. where 1 = 1
  126. <if test="type != null">
  127. and type = #{type}
  128. </if>
  129. order by create_time desc
  130. </select>
  131. <select id="countEffective" resultType="java.lang.Integer">
  132. select count(1) from week_star_gift where status = 1 and type = #{type}
  133. </select>
  134. <select id="selectWeekStartGiftByType" resultType="com.juxiao.xchat.module.xbd.vo.WeekStarGiftVO">
  135. select wsg.gift_id as giftId , g.gift_name as giftName
  136. from week_star_gift wsg
  137. left join gift g on wsg.gift_id = g.gift_id
  138. where status = 1 and type = #{type}
  139. </select>
  140. </mapper>