From 24697fbbac017b4a9af19a0491eb79d362c1d009 Mon Sep 17 00:00:00 2001 From: luozukai Date: Wed, 26 Jun 2019 10:56:08 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8D=B7][=E4=BF=AE=E6=94=B9][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2=E5=8D=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E8=BF=87=E6=BB=A4=E6=8E=89=E5=B7=B2=E4=B8=8B?= =?UTF-8?q?=E6=9E=B6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Conflicts: # mallinkService/src/main/resources/mapper/WxCouponMapper.xml --- .../main/resources/mapper/WxCouponMapper.xml | 119 +++++++++++------- 1 file changed, 77 insertions(+), 42 deletions(-) diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 3bdef39cc..633101793 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -38,6 +38,10 @@ + + + + @@ -91,7 +95,8 @@ `id`,`tenant_id`,`type`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`, `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, `remark`,`status`,`create_date`,`update_date`,`business`,`sub_business`,`support_transfer`,`subsidy_num`,`subsidy_type`, - `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund` + `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,put_apply_status,stock_apply_status,cancle_apply_status + `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,`conditions` @@ -466,7 +471,7 @@ - + = #{number} + + update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and remain_inventory>= #{remainInventory} + + update wx_coupon SET status = 1, update_date = now() where status = 0 and valid_type = 1 and valid_end_date < now() @@ -615,54 +624,79 @@ + + delete from `wx_coupon_press_data` where type = 8 and tenant_id = #{tenantId} + + + + 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} + + + + 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)/ + (select count(wop.id) from wx_order o + left join wx_order_press wop on wop.order_id = o.id + where o.product_id = cpd.id and o.tenant_id = #{tenantId} and wop.first = 1)*100,2),0) + where cpd.tenant_id = #{tenantId} + + + + update wx_coupon_press_data cpd set press_count= (select count(wop.id) from wx_order o + left join wx_order_press wop on wop.order_id = o.id + where o.product_id = cpd.id and o.tenant_id = #{tenantId} and wop.first = 1) + where cpd.tenant_id=#{tenantId} + + + + update wx_coupon_press_data cpd set + press_succ_count = + (select count(o.id) from wx_order o + where o.product_id = cpd.id and o.tenant_id = #{tenantId} and o.order_status = 1) + where cpd.tenant_id=#{tenantId} + + + + 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} + + + +