Browse Source

[营销][优化]:券数据列表使用view访问

release_toaliyun_real
hupeng 7 years ago
parent
commit
dec475d8e8
1 changed files with 16 additions and 49 deletions
  1. +16
    -49
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 16
- 49
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml View File

@@ -145,55 +145,22 @@
</select>

<select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap">
SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,
wx_coupon_order.coupon_id as couponId
,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
,(case when coupon_type &lt; 7 then
(select Count(coupon_id) from wx_coupon_order c
where coupon_order_status=1
and DATE_FORMAT(update_date,'%Y-%m-%d')=createTime
and tenant_id=#{tenantId}
and c.coupon_id=couponId
) else
(select Count(card_id) from wx_coupon_order c, wx_card_spend cs
where DATE_FORMAT(cs.create_date,'%Y-%m-%d')=createTime
and c.tenant_id=#{tenantId}
and c.coupon_id=couponId
and c.id=cs.card_id
) end)
as verifyCount
,(case when coupon_type &lt; 7 then
(select Count(DISTINCT c_user_id) from wx_coupon_order d
where coupon_order_status=1
and d.coupon_id=couponId
and DATE_FORMAT(update_date,'%Y-%m-%d')=createTime
and tenant_id=#{tenantId}
and d.coupon_id=couponId
) else
(select Count(DISTINCT cs.owner_id) from wx_coupon_order c, wx_card_spend cs
where DATE_FORMAT(cs.create_date,'%Y-%m-%d')=createTime
and c.tenant_id=#{tenantId}
and c.coupon_id=couponId
and c.id=cs.card_id
) end)
as verifyUserCount
from wx_coupon_order
join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id
where wx_coupon_order.tenant_id=#{tenantId}
<if test="startTime != null">
and wx_coupon_order.create_date &gt;= #{startTime}
</if>
<if test="endTime != null">
and wx_coupon_order.create_date &lt;= #{endTime}
</if>
<if test="couponType != null">
and wx_coupon.type = #{couponType}
</if>
<if test="couponTitle != null">
and wx_coupon.title like concat('%', #{couponTitle},'%')
</if>
GROUP BY createTime,couponId,coupon_type
order by createTime desc
SELECT createTime,couponId,couponCount,couponUserCount,verifyCount,verifyUserCount
from view_coupon_data
where view_coupon_data.tenant_id=#{tenantId}
<if test="startTime != null">
and view_coupon_data.createTime &gt;= DATE_FORMAT(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime != null">
and view_coupon_data.createTime &lt;= DATE_FORMAT(#{endTime},'%Y-%m-%d')
</if>
<if test="couponType != null">
and view_coupon_data.couponType = #{couponType}
</if>
<if test="couponTitle != null">
and view_coupon_data.couponTitle like concat('%', #{couponTitle},'%')
</if>

</select>

<select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap">


Loading…
Cancel
Save