-- 已存在 bms_product_country 时升级:增加重量段最小/最大值,便于后续按重量匹配 -- 执行后请重新在「产品列表」导入 Excel(旧数据一行一国 → 新数据按重量段多行) SET NAMES utf8mb4; ALTER TABLE bms_product_country ADD COLUMN weight_min decimal(10,3) DEFAULT NULL COMMENT '重量段最小值KG(含)' AFTER country_code, ADD COLUMN weight_max decimal(10,3) DEFAULT NULL COMMENT '重量段最大值KG(含)' AFTER weight_min; -- 旧唯一键(国家级)改为重量段级 ALTER TABLE bms_product_country DROP INDEX uk_product_country; ALTER TABLE bms_product_country ADD UNIQUE KEY uk_product_country_weight (product_code, country_name, weight_min, weight_max), ADD KEY idx_weight_match (product_code, country_code, weight_min, weight_max);