You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

101 lines
4.9 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.simple.mapper.WxCouponActionLogMapper">
  4. <resultMap id="BaseResultMap" type="com.simple.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="createtime" jdbcType="TIMESTAMP" property="createtime" />
  12. </resultMap>
  13. <sql id="allColumns">
  14. `id`,`tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`createtime`
  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` like concat('%', #{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 `createtime` = #{createtime}
  38. </if>
  39. <if test=" null != startTime ">
  40. and `createtime` >= #{startTime}
  41. </if>
  42. <if test=" null != endTime ">
  43. and `createtime` &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.simple.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 where tenant_id = #{tenantId} and `createtime` >= #{startTime} and `createtime` &lt;= #{endTime}
  59. </select>
  60. <select id="sceneDataMap" resultType="com.simple.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
  61. select DATE_FORMAT(createtime,'%m/%d') as xTime, (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%m/%d')=xTime and c.channel_type=3 and tenant_id=#{tenantId} ) as parkSendCount,(select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%m/%d')=xTime and c.channel_type=4 and tenant_id=#{tenantId}) as verifySendCount
  62. from wx_coupon_action_log where tenant_id=#{tenantId} and createtime &gt;= #{startTime} and createtime &lt;= #{endTime} group by xTime
  63. </select>
  64. <select id="sceneDataMapJoinCouponOrder" resultType="com.simple.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
  65. select DATE_FORMAT(create_date,'%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 where wx_coupon_action_log.tenant_id=#{tenantId}
  66. AND wx_coupon_order.coupon_order_status = 1 and wx_coupon_action_log.createtime &gt;= #{startTime} and wx_coupon_action_log.createtime &lt;= #{endTime}
  67. AND wx_coupon_action_log.channel_type = #{channelType} group by xTime
  68. </select>
  69. <select id="sceneDataList" resultType="com.simple.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
  70. select DATE_FORMAT(createtime,'%Y-%m-%d') as xTime, (select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%Y-%m-%d')=xTime and c.channel_type=3 and tenant_id=#{tenantId} ) as parkSendCount,(select Count(*) from wx_coupon_action_log c where DATE_FORMAT(createtime,'%Y-%m-%d')=xTime and c.channel_type=4 and tenant_id=#{tenantId}) as verifySendCount
  71. from wx_coupon_action_log where tenant_id=#{tenantId} and createtime &gt;= #{startTime} and createtime &lt;= #{endTime} group by xTime
  72. </select>
  73. <select id="sceneDataJoinCouponOrderList" resultType="com.simple.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap">
  74. 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 where wx_coupon_action_log.tenant_id=#{tenantId}
  75. AND wx_coupon_order.coupon_order_status = 1 and wx_coupon_action_log.createtime &gt;= #{startTime} and wx_coupon_action_log.createtime &lt;= #{endTime}
  76. AND wx_coupon_action_log.channel_type = #{channelType} group by xTime
  77. </select>
  78. </mapper>