CouponRuleCppsV1ServiceDaoImplMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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="couponRuleCppsV1ServiceDaoImpl">
  6. <!-- 保存规则优惠券信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveCouponRuleCppsInfo" parameterType="Map">
  8. insert into coupon_rule_cpps(
  9. quantity,crc_id,cpp_id,rule_id,community_id,gift_frequency
  10. ) values (
  11. #{quantity},#{crcId},#{cppId},#{ruleId},#{communityId},#{giftFrequency}
  12. )
  13. </insert>
  14. <!-- 查询规则优惠券信息 add by wuxw 2018-07-03 -->
  15. <select id="getCouponRuleCppsInfo" parameterType="Map" resultType="Map">
  16. select t.quantity,t.crc_id,t.crc_id crcId,t.cpp_id,t.cpp_id cppId,t.status_cd,t.status_cd
  17. statusCd,t.rule_id,t.rule_id ruleId,t.community_id,t.community_id communityId,cpp.coupon_name couponName,cr.rule_name ruleName,td.`name` toTypeName,
  18. cpp.remark,t.gift_frequency giftFrequency,td1.name giftFrequencyName
  19. from coupon_rule_cpps t
  20. left join coupon_property_pool cpp on t.cpp_id = cpp.cpp_id and cpp.status_cd = '0'
  21. left join t_dict td on td.status_cd = cpp.to_type and td.table_name = 'coupon_property_pool' and td.table_columns = 'to_type'
  22. left join coupon_rule cr on t.rule_id = cr.rule_id and cr.status_cd = '0'
  23. left join t_dict td1 on td1.status_cd = t.gift_frequency and td1.table_name = 'coupon_rule_cpps' and td1.table_columns = 'gift_frequency'
  24. where 1 =1
  25. <if test="quantity !=null and quantity != ''">
  26. and t.quantity= #{quantity}
  27. </if>
  28. <if test="crcId !=null and crcId != ''">
  29. and t.crc_id= #{crcId}
  30. </if>
  31. <if test="cppId !=null and cppId != ''">
  32. and t.cpp_id= #{cppId}
  33. </if>
  34. <if test="giftFrequency !=null and giftFrequency != ''">
  35. and t.gift_frequency= #{giftFrequency}
  36. </if>
  37. <if test="statusCd !=null and statusCd != ''">
  38. and t.status_cd= #{statusCd}
  39. </if>
  40. <if test="ruleId !=null and ruleId != ''">
  41. and t.rule_id= #{ruleId}
  42. </if>
  43. <if test="ruleIds !=null ">
  44. and t.rule_id in
  45. <foreach collection="ruleIds" item="item" open="(" close=")" separator=",">
  46. #{item}
  47. </foreach>
  48. </if>
  49. <if test="communityId !=null and communityId != ''">
  50. and t.community_id= #{communityId}
  51. </if>
  52. order by t.create_time desc
  53. <if test="page != -1 and page != null ">
  54. limit #{page}, #{row}
  55. </if>
  56. </select>
  57. <!-- 修改规则优惠券信息 add by wuxw 2018-07-03 -->
  58. <update id="updateCouponRuleCppsInfo" parameterType="Map">
  59. update coupon_rule_cpps t set t.status_cd = #{statusCd}
  60. <if test="newBId != null and newBId != ''">
  61. ,t.b_id = #{newBId}
  62. </if>
  63. <if test="quantity !=null and quantity != ''">
  64. , t.quantity= #{quantity}
  65. </if>
  66. <if test="cppId !=null and cppId != ''">
  67. , t.cpp_id= #{cppId}
  68. </if>
  69. <if test="ruleId !=null and ruleId != ''">
  70. , t.rule_id= #{ruleId}
  71. </if>
  72. <if test="giftFrequency !=null and giftFrequency != ''">
  73. , t.gift_frequency= #{giftFrequency}
  74. </if>
  75. where 1=1
  76. <if test="communityId !=null and communityId != ''">
  77. and t.community_id= #{communityId}
  78. </if>
  79. <if test="crcId !=null and crcId != ''">
  80. and t.crc_id= #{crcId}
  81. </if>
  82. </update>
  83. <!-- 查询规则优惠券数量 add by wuxw 2018-07-03 -->
  84. <select id="queryCouponRuleCppssCount" parameterType="Map" resultType="Map">
  85. select count(1) count
  86. from coupon_rule_cpps t
  87. where 1 =1
  88. <if test="quantity !=null and quantity != ''">
  89. and t.quantity= #{quantity}
  90. </if>
  91. <if test="crcId !=null and crcId != ''">
  92. and t.crc_id= #{crcId}
  93. </if>
  94. <if test="cppId !=null and cppId != ''">
  95. and t.cpp_id= #{cppId}
  96. </if>
  97. <if test="statusCd !=null and statusCd != ''">
  98. and t.status_cd= #{statusCd}
  99. </if>
  100. <if test="ruleId !=null and ruleId != ''">
  101. and t.rule_id= #{ruleId}
  102. </if>
  103. <if test="giftFrequency !=null and giftFrequency != ''">
  104. and t.gift_frequency= #{giftFrequency}
  105. </if>
  106. <if test="communityId !=null and communityId != ''">
  107. and t.community_id= #{communityId}
  108. </if>
  109. </select>
  110. </mapper>