-- ============================================
-- 供应商登录修正
-- 1. 更新密码为 123456
-- 2. 删除旧的供应商门户菜单
-- 3. 重新授权：报价请求 + 供应商报价菜单
-- ============================================

-- 1a. 更新密码
UPDATE sys_user SET password = '$2a$10$e6x.iBNqv3lYoc5O0PkkyOsQf.QC/o1aUugRssBbpOl2x79DHFBYO'
WHERE user_name IN ('hsd','boyuan','ruida','lianmeng','hzjg');

-- 1b. 删除旧的供应商门户菜单和关联
DELETE FROM sys_role_menu WHERE role_id=3;
DELETE FROM sys_menu WHERE menu_id IN (2100, 2101, 2102);

-- 1c. 供应商角色授权：报价请求（查看采购任务）+ 供应商报价（报价管理）
INSERT INTO sys_role_menu (role_id, menu_id) VALUES
(3, 2003),  -- 报价请求
(3, 2004);  -- 供应商报价

-- 验证
SELECT '=== UPDATED SUPPLIER USERS ===' AS '';
SELECT user_name, nick_name, password FROM sys_user WHERE user_name IN ('hsd','boyuan','ruida','lianmeng','hzjg');
SELECT '=== ROLE-MENU ===' AS '';
SELECT rm.menu_id, m.menu_name FROM sys_role_menu rm JOIN sys_menu m ON rm.menu_id=m.menu_id WHERE rm.role_id=3;
