@@ -274,9 +274,9 @@
where is_del = 0
<if test=" null != targetAd ">
and 0 = (select count(*) from wx_coupon_channel cc
where c.`id` = cc.coupon_id
and cc.status = 0
and cc.target_ad = #{targetAd})
where c.`id` = cc.coupon_id
and cc.status = 0
and cc.target_ad = #{targetAd})
</if>
<if test=" null != id ">
@@ -497,7 +497,7 @@
<collection column="{productId=id}" property="merchantVoList"
ofType="com.iformall.domain.vo.WxMerchantVo"
javaType="java.util.List"
select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantBaseList" >
select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantBaseList">
</collection>
</resultMap>
@@ -533,7 +533,8 @@
and m.status = 1) = 0
</update>
<select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(round(ci.sale_amount/100,2)) xcount from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
where c.type = 100
@@ -541,7 +542,8 @@
group by xtime
</select>
<select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wcs.create_date,'%Y-%m-%d') xtime,sum(round(wcs.real_payment/100,2)) xcount from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
left join wx_card_spend wcs on wcs.card_id = ci.id
@@ -612,17 +614,21 @@
<if test="id != null">
and c.id = #{id}
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by c.status asc,c.create_date desc </if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
<if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
</select>
<select id="findCouponData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
select c.*,
IFNULL(round((select count(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)/(select count(wco.id) from wx_coupon_order wco where wco.coupon_id = c.id)*100,2),0) payment_rate,
IFNULL(round((select count(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)/(select count(wco.id) from wx_coupon_order wco where wco.coupon_id
= c.id)*100,2),0) payment_rate,
(select count(wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count,
(select count(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 sum_payment,
(select count(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(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 sum_payment,
(select count(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 sum(sc.subsidy) from wx_coupon wc
left join wx_coupon_order wo on wo.coupon_id = wc.id
left join wx_merchant_subsidy sc on sc.coupon_order_id = wo.id
@@ -645,35 +651,52 @@
</select>
<select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap">
select cpd.id, cpd.`cover_img`,cpd.`title`,cpd.`sale_price`,cpd.`price`,
cpd.change_rate, cpd.press_count, cpd.press_succ_count, cpd.join_count, cpd.payment_rate
from wx_coupon_press_data cpd
left join wx_coupon c on c.id = cpd.id
<if test="id != null">
and cpd.tenant_id=#{tenantId}
select c.id, c.`cover_img`,c.`title`,c.`sale_price`,c.`price`,
IFNULL(round((select count(o.id) from wx_order o where o.tenant_id = '1006' and o.product_id = c.id and o.order_status = 1)/
(select count(op.id) from wx_order_press op where op.`tenant_id` = '1006' and op.`coupon_id` = c.`id` and op.first = 1 )*100,2),0) change_rate,
(select count(op.id) from wx_order_press op
where op.`tenant_id` = '1006' and op.first = 1 and op.coupon_id = c.id) as press_count,
(select count(o.id) from wx_order o
where o.`tenant_id` = '1006' and o.product_id = c.id and o.order_status = 1) as press_succ_count,
(select count(op.id) from wx_order_press op
where op.`tenant_id` = '1006' and op.`coupon_id` = c.`id`) as join_count,
IFNULL(round((select count(wco.id) xcount from wx_coupon_order wco
where wco.`tenant_id` = '1006' and wco.coupon_id = c.id and wco.coupon_order_status = 1
)/(select count(op.id) from wx_order_press op
where op.`tenant_id` = '1006' and op.`coupon_id` = c.`id` and op.first = 1)
*100,2),0) as payment_rate
from wx_coupon c where c.type = 8
<if test="tenantId != null">
and c.tenant_id=#{tenantId}
</if>
<if test="id != null">
and cpd.id = #{id}
and c.id = #{id}
</if>
<if test="title != null and title != ''">
and cpd.title like concat('%', #{title},'%')
and c.title like concat('%', #{title},'%')
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns"> order by c.status asc,c.create_date desc </if>
<if test=" null != startdate and null!=enddate">
and c.`create_date` between #{startdate} and #{enddate}
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
<if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
</select>
<insert id="delPressData" parameterType="com.iformall.domain.po.WxCoupon" >
delete from `wx_coupon_press_data` where type = 8 and tenant_id = #{tenantId}
<insert id="delPressData" parameterType="com.iformall.domain.po.WxCoupon">
delete from `wx_coupon_press_data` where tenant_id = #{tenantId}
</insert>
<insert id="insertPressData" parameterType="com.iformall.domain.po.WxCoupon" >
<insert id="insertPressData" parameterType="com.iformall.domain.po.WxCoupon">
insert into `wx_coupon_press_data`
(`id`, `tenant_id`, `cover_img`, `title`, `sale_price`, `price`)
select `id`, `tenant_id`, `cover_img`, `title`, `sale_price`, `price`
from wx_coupon where type = 8 and tenant_id = #{tenantId}
</insert>
<update id="updatePressData1" parameterType="com.iformall.domain.po.WxCoupon" >
<update id="updatePressData1" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon_press_data cpd set change_rate =
IFNULL(round((select count(o.id) from wx_order o
where o.tenant_id = #{tenantId} and o.order_status = 1 and o.product_id = cpd.id)/
@@ -698,12 +721,12 @@
where cpd.tenant_id=#{tenantId}
</update>
<update id="updatePressData4" parameterType="com.iformall.domain.po.WxCoupon" >
<update id="updatePressData4" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon_press_data cpd set join_count =
(select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.tenant_id = #{tenantId} and o.product_id = cpd.id and o.payment_type = 0)
where cpd.tenant_id=#{tenantId}
(select count(wop.id) from wx_order o
left join wx_order_press wop on wop.order_id = o.id
where o.tenant_id = #{tenantId} and o.product_id = cpd.id and o.payment_type = 0)
where cpd.tenant_id=#{tenantId}
</update>
<select id="updatePressData5" parameterType="com.iformall.domain.po.WxCoupon">
@@ -718,7 +741,8 @@ where cpd.tenant_id=#{tenantId}
where cpd.tenant_id=#{tenantId}
</select>
<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
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
where c.type not in(8,9,100)
@@ -727,8 +751,8 @@ where cpd.tenant_id=#{tenantId}
</select>
<select id="findCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="findCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
where c.type not in(8,9,100)
and wco.coupon_id = c.id and wco.coupon_order_status = 1
@@ -736,7 +760,8 @@ where cpd.tenant_id=#{tenantId}
group by xtime
</select>
<select id="priceCouponSaleCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="priceCouponSaleCount" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
where c.type not in(8,9,100)
and wco.coupon_id = c.id and wco.coupon_price > 0
@@ -744,7 +769,8 @@ where cpd.tenant_id=#{tenantId}
group by xtime
</select>
<select id="priceCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="priceCouponPaymentCount" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c,wx_coupon_order wco
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
@@ -774,7 +800,8 @@ where cpd.tenant_id=#{tenantId}
<!--砍价-->
<select id="pressSendHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="pressSendHistory" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
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
@@ -782,14 +809,16 @@ where cpd.tenant_id=#{tenantId}
wop.create_date between #{startdate} and #{enddate}
group by xtime
</select>
<select id="pressSuccHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="pressSuccHistory" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
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 = 1
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.vo.WxCouponStatisVo">
<select id="pressPaymentHistory" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
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
@@ -823,7 +852,7 @@ where cpd.tenant_id=#{tenantId}
and wop.create_date between #{startdate} and #{enddate}
</select>
<select id="priceCouponCancelCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
<select id="priceCouponCancelCount" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select count(c.id) from wx_coupon c
left join wx_coupon_order wco on c.id = wco.coupon_id
where c.type not in(8,9,100)
@@ -831,7 +860,8 @@ where cpd.tenant_id=#{tenantId}
and wco.coupon_order_status = 3
</select>
<select id="findSaleCardCountHistory" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.vo.WxCouponStatisVo">
<select id="findSaleCardCountHistory" parameterType="com.iformall.domain.po.WxCoupon"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(co.create_date,'%Y-%m-%d') xtime,count(co.id) xcount
from wx_card_info ci
left join wx_coupon c on c.id = ci.coupon_id
@@ -841,7 +871,8 @@ where cpd.tenant_id=#{tenantId}
group by xtime
</select>
<select id="findCouponByTopic" parameterType="com.iformall.domain.po.WxTopic" resultType="com.iformall.domain.po.WxCoupon">
<select id="findCouponByTopic" parameterType="com.iformall.domain.po.WxTopic"
resultType="com.iformall.domain.po.WxCoupon">
select ct.id as id,wc.id as couponId,
wc.tenant_id,wc.`type`,wc.`cover_img`,wc.`cover_picture`,wc.`detail_picture`,wc.`title`,wc.`sub_title`,wc.`sale_price`,wc.`use_price`,wc.`use_limit_quantity`,wc.`send_type`,
wc.`valid_type`,wc.`valid_start_date`,wc.`valid_end_date`,wc.`valid_days`,wc.`detail`,wc.`price`,wc.`unit`,wc.`remain_inventory`,wc.`inventory`,