CmSvipCouponMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei.modules.coupon.dao.CmCouponVipDao">
  4. <!-- <sql id="cmCouponColumns">-->
  5. <!-- a.id AS "id",-->
  6. <!-- a.name AS "name",-->
  7. <!-- a.couponAmount AS "couponAmount",-->
  8. <!-- a.touchPrice AS "touchPrice",-->
  9. <!-- a.startDate AS "startDate",-->
  10. <!-- a.endDate AS "endDate",-->
  11. <!-- a.status AS "status",-->
  12. <!-- a.couponType AS "couponType",-->
  13. <!-- a.userId AS "userId",-->
  14. <!-- a.shopId AS "shopId",-->
  15. <!-- a.productType AS "productType",-->
  16. <!-- a.pcBanner AS "pcBanner",-->
  17. <!-- a.appletsBanner AS "appletsBanner",-->
  18. <!-- a.categoryType AS "categoryType",-->
  19. <!-- a.couponsMode AS "couponsMode",-->
  20. <!-- a.createDate AS "createDate",-->
  21. <!-- a.delFlag AS "delFlag"-->
  22. <!-- </sql>-->
  23. <!-- <sql id="cmCouponJoins">-->
  24. <!-- </sql>-->
  25. <!-- SELECT-->
  26. <!-- <include refid="cmCouponColumns"/>,-->
  27. <!-- u.name AS "clubName",-->
  28. <!-- s.name AS "shopName"-->
  29. <!-- FROM cm_coupon a-->
  30. <!-- LEFT JOIN cm_coupon_club ccc ON ccc.couponId = a.id-->
  31. <!-- LEFT JOIN USER u ON u.userID = a.userId-->
  32. <!-- LEFT JOIN shop s ON s.shopID = a.shopId-->
  33. <!-- <include refid="cmCouponJoins"/>-->
  34. <!-- <where>-->
  35. <!-- AND a.delFlag = 0-->
  36. <!-- <if test="couponType != null">-->
  37. <!-- AND a.couponType = #{couponType}-->
  38. <!-- </if>-->
  39. <!-- <if test="name != null and name != ''">-->
  40. <!-- AND a.name LIKE-->
  41. <!-- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>-->
  42. <!-- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>-->
  43. <!-- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>-->
  44. <!-- </if>-->
  45. <!-- <if test="startDate != null and startDate != ''">-->
  46. <!-- AND a.startDate <![CDATA[ >= ]]> #{startDate}-->
  47. <!-- </if>-->
  48. <!-- <if test="endDate != null and endDate != ''">-->
  49. <!-- AND a.endDate <![CDATA[ <= ]]> #{endDate}-->
  50. <!-- </if>-->
  51. <!-- <if test='status == "0"'>-->
  52. <!-- AND a.startDate <![CDATA[ > ]]> NOW()-->
  53. <!-- </if>-->
  54. <!-- <if test='status == "1"'>-->
  55. <!-- AND a.startDate <![CDATA[ <= ]]> NOW()-->
  56. <!-- AND a.endDate <![CDATA[ >= ]]> NOW()-->
  57. <!-- AND a.status != '2'-->
  58. <!-- </if>-->
  59. <!-- <if test='status == "2"'>-->
  60. <!-- AND a.status = '2'-->
  61. <!-- </if>-->
  62. <!-- <if test='status == "3"'>-->
  63. <!-- AND a.endDate <![CDATA[ < ]]> NOW()-->
  64. <!-- </if>-->
  65. <!-- <if test="clubName != null and clubName != ''">-->
  66. <!-- AND u.name LIKE concat('%',#{clubName},'%')-->
  67. <!-- </if>-->
  68. <!-- <if test='claimStatus == "1"'>-->
  69. <!-- AND ccc.id IS NULL-->
  70. <!-- </if>-->
  71. <!-- <if test='claimStatus == "2"'>-->
  72. <!-- AND ccc.id IS NOT NULL-->
  73. <!-- </if>-->
  74. <!-- <if test='useStatus == "1"'>-->
  75. <!-- AND (ccc.status IS NULL OR ccc.status = #{useStatus})-->
  76. <!-- </if>-->
  77. <!-- <if test='useStatus == "2"'>-->
  78. <!-- AND ccc.status = #{useStatus}-->
  79. <!-- </if>-->
  80. <!-- <if test="source != null and source != ''">-->
  81. <!-- AND ccc.source = #{source}-->
  82. <!-- </if>-->
  83. <!-- <if test="shopName != null and shopName != ''">-->
  84. <!-- AND s.name LIKE concat('%',#{shopName},'%')-->
  85. <!-- </if>-->
  86. <!-- <if test="couponsMode != null and couponsMode != ''">-->
  87. <!-- AND a.couponsMode = #{couponsMode}-->
  88. <!-- </if>-->
  89. <!-- </where>-->
  90. <!-- GROUP BY a.id-->
  91. <!-- <choose>-->
  92. <!-- <when test="page !=null and page.orderBy != null and page.orderBy != ''">-->
  93. <!-- ORDER BY ${page.orderBy}-->
  94. <!-- </when>-->
  95. <!-- <otherwise>-->
  96. <!-- ORDER BY createDate DESC-->
  97. <!-- </otherwise>-->
  98. <!-- </choose>-->
  99. <select id="findAllVipCoupon" resultType="com.caimei.modules.coupon.entity.CmVipCoupon">
  100. SELECT cc.`id` AS "couponId",
  101. cc.`couponAmount`,
  102. cc.`touchPrice`,
  103. cc.`startDate`,
  104. cc.`endDate`,
  105. cc.`couponType`,
  106. cc.`shopId`,
  107. cc.`productType`,
  108. cc.`categoryType`
  109. FROM cm_coupon cc
  110. INNER JOIN cm_svip_coupon cs ON cs.couponId = cc.id
  111. WHERE cc.delFlag = 0
  112. AND cc.status != 2
  113. <if test="useTime != null and userTime != ''">
  114. AND cs.useTime=#{userTime}
  115. </if>
  116. ORDER BY cs.created_time DESC
  117. </select>
  118. </mapper>