CouponPropertyUserV1ServiceDaoImplMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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="couponPropertyUserV1ServiceDaoImpl">
  6. <!-- 保存用户优惠券信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveCouponPropertyUserInfo" parameterType="Map">
  8. insert into coupon_property_user(
  9. coupon_name,to_type,validity_day,coupon_id,user_name,user_id,cpp_id,tel,state,stock,community_id,value,start_time
  10. ) values (
  11. #{couponName},#{toType},#{validityDay},#{couponId},#{userName},#{userId},#{cppId},#{tel},#{state},#{stock},#{communityId},#{value},#{startTime}
  12. )
  13. </insert>
  14. <!-- 查询用户优惠券信息 add by wuxw 2018-07-03 -->
  15. <select id="getCouponPropertyUserInfo" parameterType="Map" resultType="Map">
  16. select t.coupon_name,t.coupon_name couponName,t.to_type,t.to_type toType,t.validity_day,t.validity_day
  17. validityDay,t.status_cd,t.status_cd statusCd,t.coupon_id,t.coupon_id couponId,t.user_name,t.user_name
  18. userName,t.user_id,t.user_id couponUserId,t.cpp_id,t.cpp_id cppId,t.tel,t.state,t.stock,t.community_id,t.community_id
  19. communityId,t.value,td.`name` toTypeName,t.create_time createTime,t.start_time startTime
  20. from coupon_property_user t
  21. left join t_dict td on td.status_cd = t.to_type and td.table_name = 'coupon_property_pool' and td.table_columns = 'to_type'
  22. where 1 =1
  23. <if test="couponName !=null and couponName != ''">
  24. and t.coupon_name= #{couponName}
  25. </if>
  26. <if test="toType !=null and toType != ''">
  27. and t.to_type= #{toType}
  28. </if>
  29. <if test="validityDay !=null and validityDay != ''">
  30. and t.validity_day= #{validityDay}
  31. </if>
  32. <if test="statusCd !=null and statusCd != ''">
  33. and t.status_cd= #{statusCd}
  34. </if>
  35. <if test="couponId !=null and couponId != ''">
  36. and t.coupon_id= #{couponId}
  37. </if>
  38. <if test="userName !=null and userName != ''">
  39. and t.user_name= #{userName}
  40. </if>
  41. <if test="couponUserId !=null and couponUserId != ''">
  42. and t.user_id= #{couponUserId}
  43. </if>
  44. <if test="cppId !=null and cppId != ''">
  45. and t.cpp_id= #{cppId}
  46. </if>
  47. <if test="tel !=null and tel != ''">
  48. and t.tel= #{tel}
  49. </if>
  50. <if test="state !=null and state != ''">
  51. and t.state= #{state}
  52. </if>
  53. <if test="stock !=null and stock != ''">
  54. and t.stock= #{stock}
  55. </if>
  56. <if test="startTime !=null and startTime != ''">
  57. and t.start_time= #{startTime}
  58. </if>
  59. <if test="communityId !=null and communityId != ''">
  60. and t.community_id= #{communityId}
  61. </if>
  62. <if test="value !=null and value != ''">
  63. and t.value= #{value}
  64. </if>
  65. order by t.create_time desc
  66. <if test="page != -1 and page != null ">
  67. limit #{page}, #{row}
  68. </if>
  69. </select>
  70. <!-- 修改用户优惠券信息 add by wuxw 2018-07-03 -->
  71. <update id="updateCouponPropertyUserInfo" parameterType="Map">
  72. update coupon_property_user t set t.status_cd = #{statusCd}
  73. <if test="newBId != null and newBId != ''">
  74. ,t.b_id = #{newBId}
  75. </if>
  76. <if test="couponName !=null and couponName != ''">
  77. , t.coupon_name= #{couponName}
  78. </if>
  79. <if test="toType !=null and toType != ''">
  80. , t.to_type= #{toType}
  81. </if>
  82. <if test="validityDay !=null and validityDay != ''">
  83. , t.validity_day= #{validityDay}
  84. </if>
  85. <if test="userName !=null and userName != ''">
  86. , t.user_name= #{userName}
  87. </if>
  88. <if test="userId !=null and userId != ''">
  89. , t.user_id= #{userId}
  90. </if>
  91. <if test="cppId !=null and cppId != ''">
  92. , t.cpp_id= #{cppId}
  93. </if>
  94. <if test="tel !=null and tel != ''">
  95. , t.tel= #{tel}
  96. </if>
  97. <if test="state !=null and state != ''">
  98. , t.state= #{state}
  99. </if>
  100. <if test="stock !=null and stock != ''">
  101. , t.stock= #{stock}
  102. </if>
  103. <if test="value !=null and value != ''">
  104. , t.value= #{value}
  105. </if>
  106. <if test="startTime !=null and startTime != ''">
  107. , t.start_time= #{startTime}
  108. </if>
  109. where 1=1
  110. <if test="couponId !=null and couponId != ''">
  111. and t.coupon_id= #{couponId}
  112. </if>
  113. <if test="communityId !=null and communityId != ''">
  114. and t.community_id= #{communityId}
  115. </if>
  116. </update>
  117. <!-- 查询用户优惠券数量 add by wuxw 2018-07-03 -->
  118. <select id="queryCouponPropertyUsersCount" parameterType="Map" resultType="Map">
  119. select count(1) count
  120. from coupon_property_user t
  121. where 1 =1
  122. <if test="couponName !=null and couponName != ''">
  123. and t.coupon_name= #{couponName}
  124. </if>
  125. <if test="toType !=null and toType != ''">
  126. and t.to_type= #{toType}
  127. </if>
  128. <if test="validityDay !=null and validityDay != ''">
  129. and t.validity_day= #{validityDay}
  130. </if>
  131. <if test="statusCd !=null and statusCd != ''">
  132. and t.status_cd= #{statusCd}
  133. </if>
  134. <if test="couponId !=null and couponId != ''">
  135. and t.coupon_id= #{couponId}
  136. </if>
  137. <if test="userName !=null and userName != ''">
  138. and t.user_name= #{userName}
  139. </if>
  140. <if test="couponUserId !=null and couponUserId != ''">
  141. and t.user_id= #{couponUserId}
  142. </if>
  143. <if test="cppId !=null and cppId != ''">
  144. and t.cpp_id= #{cppId}
  145. </if>
  146. <if test="tel !=null and tel != ''">
  147. and t.tel= #{tel}
  148. </if>
  149. <if test="state !=null and state != ''">
  150. and t.state= #{state}
  151. </if>
  152. <if test="stock !=null and stock != ''">
  153. and t.stock= #{stock}
  154. </if>
  155. <if test="communityId !=null and communityId != ''">
  156. and t.community_id= #{communityId}
  157. </if>
  158. <if test="value !=null and value != ''">
  159. and t.value= #{value}
  160. </if>
  161. <if test="startTime !=null and startTime != ''">
  162. and t.start_time= #{startTime}
  163. </if>
  164. </select>
  165. </mapper>