CouponDetailV1ServiceDaoImplMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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="couponDetailV1ServiceDaoImpl">
  6. <!-- 保存商家购买记录表信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveCouponDetailInfo" parameterType="Map">
  8. insert into coupon_detail(
  9. buy_price,coupon_name,amount,buy_count,actual_price,validity_day,pool_id,detail_id,shop_id,order_id,shop_name
  10. ) values (
  11. #{buyPrice},#{couponName},#{amount},#{buyCount},#{actualPrice},#{validityDay},#{poolId},#{detailId},#{shopId},#{orderId},#{shopName}
  12. )
  13. </insert>
  14. <!-- 查询商家购买记录表信息 add by wuxw 2018-07-03 -->
  15. <select id="getCouponDetailInfo" parameterType="Map" resultType="Map">
  16. select t.buy_price,t.buy_price buyPrice,t.coupon_name,t.coupon_name couponName,t.amount,t.buy_count,t.buy_count
  17. buyCount,t.actual_price,t.actual_price actualPrice,t.validity_day,t.validity_day validityDay,t.pool_id,t.pool_id
  18. poolId,t.detail_id,t.detail_id detailId,t.status_cd,t.status_cd statusCd,t.shop_id,t.shop_id
  19. shopId,t.order_id orderId,t.create_time createTime,t.shop_name shopName
  20. from coupon_detail t
  21. where 1 =1
  22. <if test="buyPrice !=null and buyPrice != ''">
  23. and t.buy_price= #{buyPrice}
  24. </if>
  25. <if test="couponName !=null and couponName != ''">
  26. and t.coupon_name= #{couponName}
  27. </if>
  28. <if test="amount !=null and amount != ''">
  29. and t.amount= #{amount}
  30. </if>
  31. <if test="buyCount !=null and buyCount != ''">
  32. and t.buy_count= #{buyCount}
  33. </if>
  34. <if test="shopName !=null and shopName != ''">
  35. and t.shop_name= #{shopName}
  36. </if>
  37. <if test="shopNameLike !=null and shopNameLike != ''">
  38. and t.shop_name like concat('%',#{shopNameLike},'%')
  39. </if>
  40. <if test="actualPrice !=null and actualPrice != ''">
  41. and t.actual_price= #{actualPrice}
  42. </if>
  43. <if test="validityDay !=null and validityDay != ''">
  44. and t.validity_day= #{validityDay}
  45. </if>
  46. <if test="poolId !=null and poolId != ''">
  47. and t.pool_id= #{poolId}
  48. </if>
  49. <if test="detailId !=null and detailId != ''">
  50. and t.detail_id= #{detailId}
  51. </if>
  52. <if test="statusCd !=null and statusCd != ''">
  53. and t.status_cd= #{statusCd}
  54. </if>
  55. <if test="orderId !=null and orderId != ''">
  56. and t.order_id= #{orderId}
  57. </if>
  58. <if test="createTime !=null and createTime != ''">
  59. and DATE_FORMAT(t.create_time,'%Y-%m-%d') = #{createTime}
  60. </if>
  61. <if test="shopId !=null and shopId != ''">
  62. and t.shop_id= #{shopId}
  63. </if>
  64. order by t.create_time desc
  65. <if test="page != -1 and page != null ">
  66. limit #{page}, #{row}
  67. </if>
  68. </select>
  69. <!-- 修改商家购买记录表信息 add by wuxw 2018-07-03 -->
  70. <update id="updateCouponDetailInfo" parameterType="Map">
  71. update coupon_detail t set t.status_cd = #{statusCd}
  72. <if test="newBId != null and newBId != ''">
  73. ,t.b_id = #{newBId}
  74. </if>
  75. <if test="buyPrice !=null and buyPrice != ''">
  76. , t.buy_price= #{buyPrice}
  77. </if>
  78. <if test="couponName !=null and couponName != ''">
  79. , t.coupon_name= #{couponName}
  80. </if>
  81. <if test="amount !=null and amount != ''">
  82. , t.amount= #{amount}
  83. </if>
  84. <if test="orderId !=null and orderId != ''">
  85. , t.order_id= #{orderId}
  86. </if>
  87. <if test="shopName !=null and shopName != ''">
  88. , t.shop_name= #{shopName}
  89. </if>
  90. <if test="buyCount !=null and buyCount != ''">
  91. , t.buy_count= #{buyCount}
  92. </if>
  93. <if test="actualPrice !=null and actualPrice != ''">
  94. , t.actual_price= #{actualPrice}
  95. </if>
  96. <if test="validityDay !=null and validityDay != ''">
  97. , t.validity_day= #{validityDay}
  98. </if>
  99. <if test="poolId !=null and poolId != ''">
  100. , t.pool_id= #{poolId}
  101. </if>
  102. <if test="shopId !=null and shopId != ''">
  103. , t.shop_id= #{shopId}
  104. </if>
  105. where 1=1
  106. <if test="detailId !=null and detailId != ''">
  107. and t.detail_id= #{detailId}
  108. </if>
  109. </update>
  110. <!-- 查询商家购买记录表数量 add by wuxw 2018-07-03 -->
  111. <select id="queryCouponDetailsCount" parameterType="Map" resultType="Map">
  112. select count(1) count
  113. from coupon_detail t
  114. where 1 =1
  115. <if test="buyPrice !=null and buyPrice != ''">
  116. and t.buy_price= #{buyPrice}
  117. </if>
  118. <if test="couponName !=null and couponName != ''">
  119. and t.coupon_name= #{couponName}
  120. </if>
  121. <if test="shopName !=null and shopName != ''">
  122. and t.shop_name= #{shopName}
  123. </if>
  124. <if test="shopNameLike !=null and shopNameLike != ''">
  125. and t.shop_name like concat('%',#{shopNameLike},'%')
  126. </if>
  127. <if test="amount !=null and amount != ''">
  128. and t.amount= #{amount}
  129. </if>
  130. <if test="buyCount !=null and buyCount != ''">
  131. and t.buy_count= #{buyCount}
  132. </if>
  133. <if test="orderId !=null and orderId != ''">
  134. and t.order_id= #{orderId}
  135. </if>
  136. <if test="actualPrice !=null and actualPrice != ''">
  137. and t.actual_price= #{actualPrice}
  138. </if>
  139. <if test="validityDay !=null and validityDay != ''">
  140. and t.validity_day= #{validityDay}
  141. </if>
  142. <if test="poolId !=null and poolId != ''">
  143. and t.pool_id= #{poolId}
  144. </if>
  145. <if test="detailId !=null and detailId != ''">
  146. and t.detail_id= #{detailId}
  147. </if>
  148. <if test="createTime !=null and createTime != ''">
  149. and DATE_FORMAT(t.create_time,'%Y-%m-%d') = #{createTime}
  150. </if>
  151. <if test="statusCd !=null and statusCd != ''">
  152. and t.status_cd= #{statusCd}
  153. </if>
  154. <if test="shopId !=null and shopId != ''">
  155. and t.shop_id= #{shopId}
  156. </if>
  157. </select>
  158. </mapper>