tmerclub/db/2023-10-07-去除商家钱包分片.sql

37 lines
2.1 KiB
MySQL
Raw Normal View History

2025-03-20 18:21:13 +08:00
USE tmerclub_admin;
2025-03-18 17:23:25 +08:00
ALTER TABLE shop_wallet DROP COLUMN zone_num;
ALTER TABLE supplier_wallet DROP COLUMN zone_num;
# 把钱包分片的内容整合到总钱包中
UPDATE shop_wallet sw
JOIN (SELECT SUM(unsettled_amount) AS unsettled_amount, SUM(settled_amount) AS settled_amount,
SUM(total_settled_amount) AS total_settled_amount,shop_id, pay_sys_type
FROM shop_wallet_zone
GROUP BY shop_id) zone ON zone.shop_id = sw.`shop_id` AND zone.pay_sys_type = sw.`pay_sys_type`
SET sw.unsettled_amount = zone.unsettled_amount + sw.`unsettled_amount`,
sw.`settled_amount` = zone.settled_amount + sw.`settled_amount`,
sw.`total_settled_amount` = zone.total_settled_amount + sw.`total_settled_amount`;
UPDATE supplier_wallet sw
JOIN (SELECT SUM(unsettled_amount) AS unsettled_amount, SUM(settled_amount) AS settled_amount,
SUM(total_settled_amount) AS total_settled_amount,supplier_id, pay_sys_type
FROM supplier_wallet_zone
GROUP BY supplier_id) zone ON zone.supplier_id = sw.`supplier_id` AND zone.pay_sys_type = sw.`pay_sys_type`
SET sw.unsettled_amount = zone.unsettled_amount + sw.`unsettled_amount`,
sw.`settled_amount` = zone.settled_amount + sw.`settled_amount`,
sw.`total_settled_amount` = zone.total_settled_amount + sw.`total_settled_amount`;
DROP TABLE IF EXISTS `shop_wallet_zone`;
DROP TABLE IF EXISTS `supplier_wallet_zone`;
DROP TABLE IF EXISTS `supplier_wallet_log`;
2025-03-20 18:21:13 +08:00
USE tmerclub_job;
2025-03-18 17:23:25 +08:00
DELETE FROM xxl_job_info
WHERE executor_handler IN ('zoneShopWalletToTenIfNecessary', 'zoneSupplierWalletToTenIfNecessary');
# 变更商家端公告位置
2025-03-20 18:21:13 +08:00
USE tmerclub_auth;
2025-03-18 17:23:25 +08:00
# menu_id = 253, 375都是'公告'
DELETE FROM `menu` WHERE `menu_id` IN (253, 375);
# parent_id = 145 为'店铺管理'
INSERT INTO `menu`(`menu_id`,`create_time`, `update_time`, `parent_id`, `biz_type`, `permission`, `path`, `component`, `redirect`, `always_show`, `hidden`, `name`, `title`, `icon`, `no_cache`, `breadcrumb`, `affix`, `active_menu`, `seq`)
VALUES
(669, NOW(), NOW(), 145, 1, NULL, 'notice', 'shop/notice', NULL, NULL, 0, '店铺公告', '店铺公告', '', NULL, NULL, NULL, NULL, 1);