LiveCouponMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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.LiveCouponMapper">
  6. <resultMap type="LiveCoupon" id="LiveCouponResult">
  7. <result property="couponId" column="coupon_id" />
  8. <result property="title" column="title" />
  9. <result property="integral" column="integral" />
  10. <result property="couponPrice" column="coupon_price" />
  11. <result property="useMinPrice" column="use_min_price" />
  12. <result property="couponTime" column="coupon_time" />
  13. <result property="sort" column="sort" />
  14. <result property="status" column="status" />
  15. <result property="productIds" column="product_ids" />
  16. <result property="packageCateIds" column="package_cate_ids" />
  17. <result property="type" column="type" />
  18. <result property="createTime" column="create_time" />
  19. <result property="updateTime" column="update_time" />
  20. <result property="isDel" column="is_del" />
  21. <result property="limitReceiveCount" column="limit_receive_count" />
  22. </resultMap>
  23. <sql id="selectLiveCouponVo">
  24. select coupon_id, title, integral, coupon_price, use_min_price, coupon_time, sort, status, product_ids, package_cate_ids, type, create_time, update_time, is_del,limit_receive_count from live_coupon
  25. </sql>
  26. <select id="selectLiveCouponList" parameterType="LiveCoupon" resultMap="LiveCouponResult">
  27. <include refid="selectLiveCouponVo"/>
  28. <where>
  29. <if test="title != null and title != ''"> and title = #{title}</if>
  30. <if test="integral != null and integral != ''"> and integral = #{integral}</if>
  31. <if test="couponPrice != null "> and coupon_price = #{couponPrice}</if>
  32. <if test="useMinPrice != null "> and use_min_price = #{useMinPrice}</if>
  33. <if test="couponTime != null "> and coupon_time = #{couponTime}</if>
  34. <if test="sort != null "> and sort = #{sort}</if>
  35. <if test="status != null "> and status = #{status}</if>
  36. <if test="productIds != null and productIds != ''"> and product_ids = #{productIds}</if>
  37. <if test="packageCateIds != null and packageCateIds != ''"> and package_cate_ids = #{packageCateIds}</if>
  38. <if test="type != null "> and type = #{type}</if>
  39. <if test="isDel != null "> and is_del = #{isDel}</if>
  40. <if test="limitReceiveCount != null "> and limit_receive_count = #{limitReceiveCount}</if>
  41. </where>
  42. </select>
  43. <select id="selectLiveCouponById" parameterType="Long" resultMap="LiveCouponResult">
  44. <include refid="selectLiveCouponVo"/>
  45. where coupon_id = #{couponId}
  46. </select>
  47. <insert id="insertLiveCoupon" parameterType="LiveCoupon" useGeneratedKeys="true" keyProperty="couponId">
  48. insert into live_coupon
  49. <trim prefix="(" suffix=")" suffixOverrides=",">
  50. <if test="title != null and title != ''">title,</if>
  51. <if test="integral != null">integral,</if>
  52. <if test="couponPrice != null">coupon_price,</if>
  53. <if test="useMinPrice != null">use_min_price,</if>
  54. <if test="couponTime != null">coupon_time,</if>
  55. <if test="sort != null">sort,</if>
  56. <if test="status != null">status,</if>
  57. <if test="productIds != null">product_ids,</if>
  58. <if test="packageCateIds != null">package_cate_ids,</if>
  59. <if test="type != null">type,</if>
  60. <if test="createTime != null">create_time,</if>
  61. <if test="updateTime != null">update_time,</if>
  62. <if test="isDel != null">is_del,</if>
  63. <if test="limitReceiveCount != null">limit_receive_count,</if>
  64. </trim>
  65. <trim prefix="values (" suffix=")" suffixOverrides=",">
  66. <if test="title != null and title != ''">#{title},</if>
  67. <if test="integral != null">#{integral},</if>
  68. <if test="couponPrice != null">#{couponPrice},</if>
  69. <if test="useMinPrice != null">#{useMinPrice},</if>
  70. <if test="couponTime != null">#{couponTime},</if>
  71. <if test="sort != null">#{sort},</if>
  72. <if test="status != null">#{status},</if>
  73. <if test="productIds != null">#{productIds},</if>
  74. <if test="packageCateIds != null">#{packageCateIds},</if>
  75. <if test="type != null">#{type},</if>
  76. <if test="createTime != null">#{createTime},</if>
  77. <if test="updateTime != null">#{updateTime},</if>
  78. <if test="isDel != null">#{isDel},</if>
  79. <if test="limitReceiveCount != null">#{limitReceiveCount},</if>
  80. </trim>
  81. </insert>
  82. <update id="updateLiveCoupon" parameterType="LiveCoupon">
  83. update live_coupon
  84. <trim prefix="SET" suffixOverrides=",">
  85. <if test="title != null and title != ''">title = #{title},</if>
  86. <if test="integral != null">integral = #{integral},</if>
  87. <if test="couponPrice != null">coupon_price = #{couponPrice},</if>
  88. <if test="useMinPrice != null">use_min_price = #{useMinPrice},</if>
  89. <if test="couponTime != null">coupon_time = #{couponTime},</if>
  90. <if test="sort != null">sort = #{sort},</if>
  91. <if test="status != null">status = #{status},</if>
  92. <if test="productIds != null">product_ids = #{productIds},</if>
  93. <if test="packageCateIds != null">package_cate_ids = #{packageCateIds},</if>
  94. <if test="type != null">type = #{type},</if>
  95. <if test="createTime != null">create_time = #{createTime},</if>
  96. <if test="updateTime != null">update_time = #{updateTime},</if>
  97. <if test="isDel != null">is_del = #{isDel},</if>
  98. <if test="limitReceiveCount != null">limit_receive_count = #{limitReceiveCount},</if>
  99. </trim>
  100. where coupon_id = #{couponId}
  101. </update>
  102. <delete id="deleteLiveCouponById" parameterType="Long">
  103. delete from live_coupon where coupon_id = #{couponId}
  104. </delete>
  105. <delete id="deleteLiveCouponByIds" parameterType="String">
  106. delete from live_coupon where coupon_id in
  107. <foreach item="couponId" collection="array" open="(" separator="," close=")">
  108. #{couponId}
  109. </foreach>
  110. </delete>
  111. <delete id="handleDeleteSelectedAdmin" parameterType="com.fs.live.vo.LiveCouponListVo">
  112. delete from live_coupon_issue_relation
  113. WHERE live_id = #{listVo.liveId} AND coupon_issue_id IN
  114. <foreach item="couponId" collection="listVo.couponIds" open="(" separator="," close=")">
  115. #{couponId}
  116. </foreach>
  117. </delete>
  118. <update id="updateLiveCouponBind" parameterType="com.fs.live.vo.LiveCouponListVo">
  119. update live_coupon_issue_relation set goods_id = #{listVo.goodsId}
  120. WHERE live_id = #{listVo.liveId} AND coupon_issue_id = #{listVo.couponId}
  121. </update>
  122. </mapper>