CouponPoolV1ServiceDaoImplMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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="couponPoolV1ServiceDaoImpl">
  6. <!-- 保存优惠券池信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveCouponPoolInfo" parameterType="Map">
  8. insert into coupon_pool(
  9. buy_price,coupon_name,coupon_stock,actual_price,validity_day,coupon_type,pool_id,state,seq
  10. ) values (
  11. #{buyPrice},#{couponName},#{couponStock},#{actualPrice},#{validityDay},#{couponType},#{poolId},#{state},#{seq}
  12. )
  13. </insert>
  14. <!-- 查询优惠券池信息 add by wuxw 2018-07-03 -->
  15. <select id="getCouponPoolInfo" parameterType="Map" resultType="Map">
  16. select t.buy_price,t.buy_price buyPrice,t.coupon_name,t.coupon_name couponName,t.coupon_stock,t.coupon_stock
  17. couponStock,t.actual_price,t.actual_price actualPrice,t.validity_day,t.validity_day
  18. validityDay,t.coupon_type,t.coupon_type couponType,t.pool_id,t.pool_id poolId,t.status_cd,t.status_cd
  19. statusCd,t.state,t.seq,td.name couponTypeName
  20. from coupon_pool t
  21. left join t_dict td on t.coupon_type = td.status_cd and td.table_columns ='coupon_type' and td.table_name ='coupon_pool'
  22. where 1 =1
  23. <if test="buyPrice !=null and buyPrice != ''">
  24. and t.buy_price= #{buyPrice}
  25. </if>
  26. <if test="couponName !=null and couponName != ''">
  27. and t.coupon_name= #{couponName}
  28. </if>
  29. <if test="couponStock !=null and couponStock != ''">
  30. and t.coupon_stock= #{couponStock}
  31. </if>
  32. <if test="actualPrice !=null and actualPrice != ''">
  33. and t.actual_price= #{actualPrice}
  34. </if>
  35. <if test="validityDay !=null and validityDay != ''">
  36. and t.validity_day= #{validityDay}
  37. </if>
  38. <if test="couponType !=null and couponType != ''">
  39. and t.coupon_type= #{couponType}
  40. </if>
  41. <if test="poolId !=null and poolId != ''">
  42. and t.pool_id= #{poolId}
  43. </if>
  44. <if test="statusCd !=null and statusCd != ''">
  45. and t.status_cd= #{statusCd}
  46. </if>
  47. <if test="state !=null and state != ''">
  48. and t.state= #{state}
  49. </if>
  50. <if test="seq !=null and seq != ''">
  51. and t.seq= #{seq}
  52. </if>
  53. order by t.create_time desc
  54. <if test="page != -1 and page != null ">
  55. limit #{page}, #{row}
  56. </if>
  57. </select>
  58. <!-- 修改优惠券池信息 add by wuxw 2018-07-03 -->
  59. <update id="updateCouponPoolInfo" parameterType="Map">
  60. update coupon_pool t set t.status_cd = #{statusCd}
  61. <if test="newBId != null and newBId != ''">
  62. ,t.b_id = #{newBId}
  63. </if>
  64. <if test="buyPrice !=null and buyPrice != ''">
  65. , t.buy_price= #{buyPrice}
  66. </if>
  67. <if test="couponName !=null and couponName != ''">
  68. , t.coupon_name= #{couponName}
  69. </if>
  70. <if test="couponStock !=null and couponStock != ''">
  71. , t.coupon_stock= #{couponStock}
  72. </if>
  73. <if test="actualPrice !=null and actualPrice != ''">
  74. , t.actual_price= #{actualPrice}
  75. </if>
  76. <if test="validityDay !=null and validityDay != ''">
  77. , t.validity_day= #{validityDay}
  78. </if>
  79. <if test="couponType !=null and couponType != ''">
  80. , t.coupon_type= #{couponType}
  81. </if>
  82. <if test="state !=null and state != ''">
  83. , t.state= #{state}
  84. </if>
  85. <if test="seq !=null and seq != ''">
  86. , t.seq= #{seq}
  87. </if>
  88. where 1=1
  89. <if test="poolId !=null and poolId != ''">
  90. and t.pool_id= #{poolId}
  91. </if>
  92. </update>
  93. <!-- 查询优惠券池数量 add by wuxw 2018-07-03 -->
  94. <select id="queryCouponPoolsCount" parameterType="Map" resultType="Map">
  95. select count(1) count
  96. from coupon_pool t
  97. left join t_dict td on t.coupon_type = td.status_cd and td.table_columns ='coupon_type' and td.table_name ='coupon_pool'
  98. where 1 =1
  99. <if test="buyPrice !=null and buyPrice != ''">
  100. and t.buy_price= #{buyPrice}
  101. </if>
  102. <if test="couponName !=null and couponName != ''">
  103. and t.coupon_name= #{couponName}
  104. </if>
  105. <if test="couponStock !=null and couponStock != ''">
  106. and t.coupon_stock= #{couponStock}
  107. </if>
  108. <if test="actualPrice !=null and actualPrice != ''">
  109. and t.actual_price= #{actualPrice}
  110. </if>
  111. <if test="validityDay !=null and validityDay != ''">
  112. and t.validity_day= #{validityDay}
  113. </if>
  114. <if test="couponType !=null and couponType != ''">
  115. and t.coupon_type= #{couponType}
  116. </if>
  117. <if test="poolId !=null and poolId != ''">
  118. and t.pool_id= #{poolId}
  119. </if>
  120. <if test="statusCd !=null and statusCd != ''">
  121. and t.status_cd= #{statusCd}
  122. </if>
  123. <if test="state !=null and state != ''">
  124. and t.state= #{state}
  125. </if>
  126. <if test="seq !=null and seq != ''">
  127. and t.seq= #{seq}
  128. </if>
  129. </select>
  130. </mapper>