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}
+
+
+
+