@@ -37,6 +37,10 @@
<result column="transfer_count" property="transferCount"/>
<result column="transfer_count" property="transferCount"/>
<result column="sale_amount" property="saleAmount"/>
<result column="sale_amount" property="saleAmount"/>
<result column="sum_payment" property="sumPayment"/>
<result column="sum_payment" property="sumPayment"/>
<result column="press_count" property="pressSendCount"/>
<result column="press_succ_count" property="pressSuccCount"/>
<result column="join_count" property="pressJoinCount"/>
</resultMap>
</resultMap>
<sql id="allColumns">
<sql id="allColumns">
@@ -668,7 +672,8 @@
<select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
<select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(ci.sale_amount) xcount from wx_card_info ci
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(ci.sale_amount) xcount from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
left join wx_coupon c on c.id = ci.coupon_id
where ci.create_date between #{startdate} and #{enddate}
where c.type = 100
and ci.create_date between #{startdate} and #{enddate}
group by xtime
group by xtime
</select>
</select>
@@ -676,7 +681,8 @@
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(wcs.payment) xcount from wx_card_info ci
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(wcs.payment) xcount from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
left join wx_coupon c on c.id = ci.coupon_id
left join wx_card_spend wcs on wcs.card_id = ci.id
left join wx_card_spend wcs on wcs.card_id = ci.id
where ci.create_date between #{startdate} and #{enddate}
where c.type = 100
and ci.create_date between #{startdate} and #{enddate}
group by xtime
group by xtime
</select>
</select>
@@ -685,19 +691,20 @@
from wx_card_info ci
from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
left join wx_coupon c on c.id = ci.coupon_id
left join wx_coupon_order co on co.id = ci.id
left join wx_coupon_order co on co.id = ci.id
where c.create_date between #{startdate} and #{enddate}
where c.type = 100
and c.create_date between #{startdate} and #{enddate}
</select>
</select>
<select id="findTranCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
<select id="findTranCardCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select count(distinct wcs.coupon_order_id) from wx_card_info ci
select count(distinct wcs.coupon_order_id) from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
left join wx_coupon c on c.id = ci.coupon_id
left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id
left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id
where c.create_date between #{startdate} and #{enddate}
where c.type = 100 and c. create_date between #{startdate} and #{enddate}
</select>
</select>
<select id="findSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
<select id="findSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select sum(subsidy_num) from wx_coupon c
select sum(subsidy_num) from wx_coupon c
where c.create_date between #{startdate} and #{enddate}
where c.type = 100 and c. create_date between #{startdate} and #{enddate}
<if test="id != null">
<if test="id != null">
and c.id = #{id}
and c.id = #{id}
</if>
</if>
@@ -716,7 +723,8 @@
(select sum(wcs.payment) from wx_card_info ci
(select sum(wcs.payment) from wx_card_info ci
left join wx_coupon wc on wc.id = ci.coupon_id
left join wx_coupon wc on wc.id = ci.coupon_id
left join wx_card_spend wcs on wcs.card_id = ci.id
left join wx_card_spend wcs on wcs.card_id = ci.id
where wc.id = c.id) as sum_payment
where c.type = 100
and wc.id = c.id) as sum_payment
from wx_coupon c where 1=1
from wx_coupon c where 1=1
<if test="id != null">
<if test="id != null">
and c.id = #{id}
and c.id = #{id}
@@ -729,7 +737,7 @@
(select count(distinct wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count,
(select count(distinct wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count,
(select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count,
(select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count,
(select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count
(select count(distinct wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count
from wx_coupon c where 1=1
from wx_coupon c where c.type not in(8,9,100)
<if test=" 1 == type ">
<if test=" 1 == type ">
and c.sale_price > 0
and c.sale_price > 0
</if>
</if>
@@ -742,6 +750,26 @@
order by status asc,create_date desc
order by status asc,create_date desc
</select>
</select>
<select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.*,
(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wop.first = 1 and wc.id = c.id) as press_count,
(select count(wo.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wo.order_status = 7 and wc.id = c.id) as press_succ_count,
(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wc.id = c.id) as join_count
from wx_coupon c where c.type = 8
<if test="id != null">
and c.id = #{id}
</if>
order by status asc,create_date desc
</select>
<!--
<!--
<select id="findCouponSendCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
<select id="findCouponSendCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(c.create_time,'%Y-%m-%d') xtime,count(id) xcount from wx_coupon_action_log c
select DATE_FORMAT(c.create_time,'%Y-%m-%d') xtime,count(id) xcount from wx_coupon_action_log c
@@ -761,7 +789,7 @@
<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c
left join wx_coupon_order wco on c.id = wco.coupon_id
left join wx_coupon_order wco on c.id = wco.coupon_id
where 1=1
where c.type not in(8,9,100)
and wco.create_date between #{startdate} and #{enddate}
and wco.create_date between #{startdate} and #{enddate}
group by xtime
group by xtime
</select>
</select>
@@ -770,21 +798,24 @@
<select id="findCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
<select id="findCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
where wco.coupon_id = c.id and wco.coupon_order_status = 1
where c.type not in(8,9,100)
and wco.coupon_id = c.id and wco.coupon_order_status = 1
and wco.create_date between #{startdate} and #{enddate}
and wco.create_date between #{startdate} and #{enddate}
group by xtime
group by xtime
</select>
</select>
<select id="priceCouponSaleCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
<select id="priceCouponSaleCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
where wco.coupon_id = c.id and wco.coupon_price > 0
where c.type not in(8,9,100)
and wco.coupon_id = c.id and wco.coupon_price > 0
and wco.create_date between #{startdate} and #{enddate}
and wco.create_date between #{startdate} and #{enddate}
group by xtime
group by xtime
</select>
</select>
<select id="priceCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
<select id="priceCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
where wco.coupon_id = c.id and wco.coupon_order_status = 1 and wco.coupon_price > 0
where c.type not in(8,9,100)
and wco.coupon_id = c.id and wco.coupon_order_status = 1 and wco.coupon_price > 0
and wco.create_date between #{startdate} and #{enddate}
and wco.create_date between #{startdate} and #{enddate}
group by xtime
group by xtime
</select>
</select>
@@ -806,4 +837,52 @@
where wco.coupon_id = c.id
where wco.coupon_id = c.id
and wco.create_date between #{startdate} and #{enddate}
and wco.create_date between #{startdate} and #{enddate}
</select>
</select>
<!--砍价-->
<select id="pressSendHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wop.create_date,'%Y-%m-%d') xtime,count(wop.id) xcount from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wc.type = 8 and wop.first = 1 and
wop.create_date between #{startdate} and #{enddate}
group by xtime
</select>
<select id="pressSuccHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wo.create_date,'%Y-%m-%d') xtime,count(wo.id) xcount from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wc.type = 8 and wo.order_status = 7
and wo.create_date between #{startdate} and #{enddate}
group by xtime
</select>
<select id="pressPaymentHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon wc
left join wx_coupon_order wco on wco.coupon_id = wc.id
where wc.type = 8 and wco.coupon_order_status = 1
and wco.create_date between #{startdate} and #{enddate}
group by xtime
</select>
<select id="pressSuccRate" parameterType="com.iformall.domain.po.WxCoupon" resultType="java.lang.Double">
select
round(
(select count(wo.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
where wo.order_status = 7 and wc.type = 8
and wo.create_date between #{startdate} and #{enddate})
/
(select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wop.first = 1 and wc.type = 8
and wop.create_date between #{startdate} and #{enddate})
* 100
,2)
</select>
<select id="sumJoin" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select count(wop.id) from wx_coupon wc
left join wx_order wo on wo.product_id = wc.id
left join wx_order_press wop on wop.order_id = wo.id
where wc.type = 8
and wop.create_date between #{startdate} and #{enddate}
</select>
</mapper>
</mapper>