-- ════════════════════════════════════════════════════════════════════
-- 消息通知中心 - 修复脚本 #3
-- 修复内容:
--   1. 修复通知菜单路径为绝对路径 /bid/notify（解决"查看全部" 404）
--   2. 修复所有通知的 bizUrl 跳转路径（解决"查看详情" 404）
-- ════════════════════════════════════════════════════════════════════
SET NAMES utf8mb4;

-- 1. 修复通知菜单路径为绝对路径，使 /bid/notify 路由生效
UPDATE sys_menu SET path = '/bid/notify' WHERE menu_id = 2170;

-- 2. 修复现有通知的 bizUrl（将旧路径改为正确路径）
UPDATE biz_notify_message SET biz_url = REPLACE(biz_url, '/bid/purchaseorder?id=',  '/quote/purchaseorder?id=')       WHERE biz_url LIKE '/bid/purchaseorder?id=%';
UPDATE biz_notify_message SET biz_url = REPLACE(biz_url, '/bid/clientquote?id=',    '/bid/clientquote/detail?id=') WHERE biz_url LIKE '/bid/clientquote?id=%';
UPDATE biz_notify_message SET biz_url = REPLACE(biz_url, '/bid/quotation?quotationId=', '/quote/quotation?quotationId=') WHERE biz_url LIKE '/bid/quotation?quotationId=%';
UPDATE biz_notify_message SET biz_url = REPLACE(biz_url, '/bid/order/pending?id=',  '/bid/order/pending?id=')       WHERE biz_url LIKE '/bid/order/pending?id=%';
UPDATE biz_notify_message SET biz_url = REPLACE(biz_url, '/bid/objection?id=',      '/bid/order/objection?id=')     WHERE biz_url LIKE '/bid/objection?id=%';
