Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

181 строка
6.4 KiB

  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.iformall.mapper.WxCouponActionLogMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponActionLog">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="coupon_id" jdbcType="BIGINT" property="couponId" />
  8. <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
  9. <result column="channel_type" jdbcType="INTEGER" property="channelType" />
  10. <result column="channel_id" jdbcType="BIGINT" property="channelId" />
  11. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  12. </resultMap>
  13. <sql id="allColumns">
  14. `id`,`tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time`
  15. </sql>
  16. <sql id="dynamicWhereConditions">
  17. where 1 = 1
  18. <if test=" null != id ">
  19. and `id` = #{id}
  20. </if>
  21. <if test=" null != tenantId ">
  22. and `tenant_id` = #{tenantId}
  23. </if>
  24. <if test=" null != couponId ">
  25. and `coupon_id` = #{couponId}
  26. </if>
  27. <if test=" null != couponOrderId ">
  28. and `coupon_order_id` = #{couponOrderId}
  29. </if>
  30. <if test=" null != channelType ">
  31. and `channel_type` = #{channelType}
  32. </if>
  33. <if test=" null != channelId ">
  34. and `channel_id` = #{channelId}
  35. </if>
  36. <if test=" null != createTime ">
  37. and `create_time` = #{createTime}
  38. </if>
  39. <if test=" null != startTime ">
  40. and `create_time` &gt;= #{startTime}
  41. </if>
  42. <if test=" null != endTime ">
  43. and `create_time` &lt;= #{endTime}
  44. </if>
  45. <if test=" null != ids ">
  46. and id in
  47. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  48. #{idItem}
  49. </foreach>
  50. </if>
  51. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  52. </sql>
  53. <select id="findList" parameterType="com.iformall.domain.po.WxCouponActionLog" resultMap="BaseResultMap">
  54. select <include refid="allColumns" /> from wx_coupon_action_log
  55. <include refid="dynamicWhereConditions" />
  56. </select>
  57. <select id="findCountByDateLimit" resultType="java.lang.Integer">
  58. select COUNT(*) FROM wx_coupon_action_log
  59. where tenant_id = #{tenantId}
  60. and `create_time` &gt;= #{startTime}
  61. and `create_time` &lt;= #{endTime}
  62. </select>
  63. <select id="sceneDataMap" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
  64. select DATE_FORMAT(create_time,'%m/%d') as xTime,
  65. (select Count(*) from wx_coupon_action_log c
  66. where DATE_FORMAT(create_time,'%m/%d')=xTime
  67. and c.channel_type=2
  68. and tenant_id=#{tenantId} ) as parkSendCount,
  69. (select Count(*) from wx_coupon_action_log c
  70. where DATE_FORMAT(create_time,'%m/%d')=xTime
  71. and c.channel_type=3
  72. and tenant_id=#{tenantId}) as verifySendCount
  73. from wx_coupon_action_log
  74. where tenant_id=#{tenantId}
  75. and create_time &gt;= #{startTime}
  76. and create_time &lt;= #{endTime}
  77. group by xTime
  78. order by xTime desc
  79. </select>
  80. <select id="sceneDataMapJoinCouponOrder" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
  81. select DATE_FORMAT(create_date,'%m/%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log
  82. left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
  83. where wx_coupon_action_log.tenant_id=#{tenantId}
  84. ----- and wx_coupon_order.coupon_order_status = 1 ----
  85. and wx_coupon_action_log.create_time &gt;= #{startTime}
  86. and wx_coupon_action_log.create_time &lt;= #{endTime}
  87. and wx_coupon_action_log.channel_type = #{channelType}
  88. group by xTime
  89. order by xTime desc
  90. </select>
  91. <select id="sceneDataList" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
  92. select DATE_FORMAT(create_time,'%Y-%m-%d') as xTime,
  93. (select Count(*) from wx_coupon_action_log c
  94. where DATE_FORMAT(create_time,'%Y-%m-%d')=xTime
  95. and c.channel_type=2
  96. and tenant_id=#{tenantId} ) as parkSendCount,
  97. (select Count(*) from wx_coupon_action_log c
  98. where DATE_FORMAT(create_time,'%Y-%m-%d')=xTime
  99. and c.channel_type=3
  100. and tenant_id=#{tenantId}) as verifySendCount,
  101. (select Count(*) from wx_coupon_action_log c
  102. where DATE_FORMAT(create_time,'%Y-%m-%d')=xTime
  103. and c.channel_type=4
  104. and tenant_id=#{tenantId}) as microPaySendCount
  105. from wx_coupon_action_log
  106. where tenant_id=#{tenantId}
  107. <if test=" null != startTime ">
  108. and create_time &gt;= #{startTime}
  109. </if>
  110. <if test=" null != endTime ">
  111. and create_time &lt;= #{endTime}
  112. </if>
  113. group by xTime
  114. order by xTime desc
  115. </select>
  116. <select id="sceneDataJoinCouponOrderList" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
  117. select DATE_FORMAT(create_date,'%Y-%m-%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
  118. where wx_coupon_action_log.tenant_id=#{tenantId}
  119. and wx_coupon_order.coupon_order_status = 1
  120. <if test=" null != startTime ">
  121. and wx_coupon_action_log.create_time &gt;= #{startTime}
  122. </if>
  123. <if test=" null != endTime ">
  124. and wx_coupon_action_log.create_time &lt;= #{endTime}
  125. </if>
  126. and wx_coupon_action_log.channel_type = #{channelType}
  127. group by xTime
  128. order by xTime desc
  129. </select>
  130. <select id="getCountByChannelId" resultType="java.lang.Integer">
  131. select COUNT(*) FROM wx_coupon_action_log
  132. where tenant_id = #{tenantId}
  133. and channel_type = #{channelType}
  134. and channel_id = #{channelId}
  135. </select>
  136. <select id="getCountByUser" resultType="java.lang.Integer" parameterType="hashmap">
  137. select COUNT(*)
  138. FROM wx_coupon_action_log a, wx_coupon_order o
  139. WHERE a.coupon_order_id = o.id
  140. AND a.tenant_id = #{tenantId}
  141. AND o.c_user_id = #{cUserId}
  142. AND date(a.create_time) = curdate()
  143. </select>
  144. <select id="getCountByUserAndCoupon" resultType="java.lang.Integer" parameterType="hashmap">
  145. select COUNT(*)
  146. FROM wx_coupon_action_log a, wx_coupon_order o
  147. WHERE a.coupon_order_id = o.id
  148. AND a.tenant_id = #{tenantId}
  149. AND o.c_user_id = #{cUserId}
  150. AND a.coupon_id = #{couponId}
  151. AND date(a.create_time) between date_sub(curdate(),interval #{dayNum} day) and curdate()
  152. </select>
  153. </mapper>