CouponPropertyPoolV1ServiceDaoImplMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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="couponPropertyPoolV1ServiceDaoImpl">
  6. <!-- 保存优惠券信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveCouponPropertyPoolInfo" parameterType="Map">
  8. insert into coupon_property_pool(
  9. coupon_name,to_type,from_type,validity_day,cpp_id,community_name,state,community_id,stock,from_id,remark
  10. ) values (
  11. #{couponName},#{toType},#{fromType},#{validityDay},#{cppId},#{communityName},#{state},#{communityId},#{stock},#{fromId},#{remark}
  12. )
  13. </insert>
  14. <!-- 查询优惠券信息 add by wuxw 2018-07-03 -->
  15. <select id="getCouponPropertyPoolInfo" parameterType="Map" resultType="Map">
  16. select t.coupon_name,t.coupon_name couponName,t.to_type,t.to_type toType,t.from_type,t.from_type
  17. fromType,t.validity_day,t.validity_day validityDay,t.cpp_id,t.cpp_id cppId,t.community_name,t.community_name
  18. communityName,t.status_cd,t.status_cd statusCd,t.state,t.community_id,t.community_id
  19. communityId,t.stock,t.from_id,t.from_id fromId,td.name fromTypeName,td1.`name` toTypeName,t.create_time createTime,t.remark
  20. from coupon_property_pool t
  21. left join t_dict td on td.status_cd = t.from_type and td.table_name = 'coupon_property_pool' and td.table_columns = 'from_type'
  22. left join t_dict td1 on td1.status_cd = t.to_type and td1.table_name = 'coupon_property_pool' and td1.table_columns = 'to_type'
  23. where 1 =1
  24. <if test="couponName !=null and couponName != ''">
  25. and t.coupon_name= #{couponName}
  26. </if>
  27. <if test="toType !=null and toType != ''">
  28. and t.to_type= #{toType}
  29. </if>
  30. <if test="fromType !=null and fromType != ''">
  31. and t.from_type= #{fromType}
  32. </if>
  33. <if test="validityDay !=null and validityDay != ''">
  34. and t.validity_day= #{validityDay}
  35. </if>
  36. <if test="cppId !=null and cppId != ''">
  37. and t.cpp_id= #{cppId}
  38. </if>
  39. <if test="communityName !=null and communityName != ''">
  40. and t.community_name= #{communityName}
  41. </if>
  42. <if test="statusCd !=null and statusCd != ''">
  43. and t.status_cd= #{statusCd}
  44. </if>
  45. <if test="state !=null and state != ''">
  46. and t.state= #{state}
  47. </if>
  48. <if test="communityId !=null and communityId != ''">
  49. and t.community_id= #{communityId}
  50. </if>
  51. <if test="stock !=null and stock != ''">
  52. and t.stock= #{stock}
  53. </if>
  54. <if test="fromId !=null and fromId != ''">
  55. and t.from_id= #{fromId}
  56. </if>
  57. order by t.create_time desc
  58. <if test="page != -1 and page != null ">
  59. limit #{page}, #{row}
  60. </if>
  61. </select>
  62. <!-- 修改优惠券信息 add by wuxw 2018-07-03 -->
  63. <update id="updateCouponPropertyPoolInfo" parameterType="Map">
  64. update coupon_property_pool t set t.status_cd = #{statusCd}
  65. <if test="newBId != null and newBId != ''">
  66. ,t.b_id = #{newBId}
  67. </if>
  68. <if test="couponName !=null and couponName != ''">
  69. , t.coupon_name= #{couponName}
  70. </if>
  71. <if test="toType !=null and toType != ''">
  72. , t.to_type= #{toType}
  73. </if>
  74. <if test="fromType !=null and fromType != ''">
  75. , t.from_type= #{fromType}
  76. </if>
  77. <if test="validityDay !=null and validityDay != ''">
  78. , t.validity_day= #{validityDay}
  79. </if>
  80. <if test="communityName !=null and communityName != ''">
  81. , t.community_name= #{communityName}
  82. </if>
  83. <if test="state !=null and state != ''">
  84. , t.state= #{state}
  85. </if>
  86. <if test="communityId !=null and communityId != ''">
  87. , t.community_id= #{communityId}
  88. </if>
  89. <if test="stock !=null and stock != ''">
  90. , t.stock= #{stock}
  91. </if>
  92. <if test="fromId !=null and fromId != ''">
  93. , t.from_id= #{fromId}
  94. </if>
  95. <if test="remark !=null and remark != ''">
  96. , t.remark= #{remark}
  97. </if>
  98. where 1=1
  99. <if test="cppId !=null and cppId != ''">
  100. and t.cpp_id= #{cppId}
  101. </if>
  102. </update>
  103. <!-- 查询优惠券数量 add by wuxw 2018-07-03 -->
  104. <select id="queryCouponPropertyPoolsCount" parameterType="Map" resultType="Map">
  105. select count(1) count
  106. from coupon_property_pool t
  107. where 1 =1
  108. <if test="couponName !=null and couponName != ''">
  109. and t.coupon_name= #{couponName}
  110. </if>
  111. <if test="toType !=null and toType != ''">
  112. and t.to_type= #{toType}
  113. </if>
  114. <if test="fromType !=null and fromType != ''">
  115. and t.from_type= #{fromType}
  116. </if>
  117. <if test="validityDay !=null and validityDay != ''">
  118. and t.validity_day= #{validityDay}
  119. </if>
  120. <if test="cppId !=null and cppId != ''">
  121. and t.cpp_id= #{cppId}
  122. </if>
  123. <if test="communityName !=null and communityName != ''">
  124. and t.community_name= #{communityName}
  125. </if>
  126. <if test="statusCd !=null and statusCd != ''">
  127. and t.status_cd= #{statusCd}
  128. </if>
  129. <if test="state !=null and state != ''">
  130. and t.state= #{state}
  131. </if>
  132. <if test="communityId !=null and communityId != ''">
  133. and t.community_id= #{communityId}
  134. </if>
  135. <if test="stock !=null and stock != ''">
  136. and t.stock= #{stock}
  137. </if>
  138. <if test="fromId !=null and fromId != ''">
  139. and t.from_id= #{fromId}
  140. </if>
  141. </select>
  142. </mapper>