-- =====================================================
-- 菜单种子数据 - 匹配前端静态路由结构
-- =====================================================
-- 清空旧数据
DELETE FROM t_role_menu WHERE role_id = 1;
DELETE FROM t_role_menu WHERE menu_id IN (2001,2002,2003,2004,3001,3002,4001,4002,5001,5002);
DELETE FROM t_menu WHERE id >= 100 AND id < 1200;
DELETE FROM t_menu WHERE id IN (2001,2002,2003,2004,3001,3002,4001,4002,5001,5002);

-- =====================================================
-- 1. 数据概览 (Dashboard) - rank 1
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(100, 0, 0, '数据概览', 'Dashboard', '/dashboard', '', 1, 'ri:dashboard-line', 1, 1, '/dashboard/index', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(101, 100, 0, '数据概览', 'Dashboard', '/dashboard/index', '', 1, 1, 0);

-- =====================================================
-- 2. 订单管理 (Order) - rank 2
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(200, 0, 0, '订单管理', 'Order', '/order', '', 2, 'ri:file-list-2-line', 1, 1, '/order/list', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(201, 200, 0, '订单管理', 'OrderList', '/order/list', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(202, 200, 0, '退款管理', 'OrderRefund', '/order/refund', '', 2, 1, 0);

-- =====================================================
-- 3. 运营管理 (Operation) - rank 3
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(300, 0, 0, '运营管理', 'Operation', '/operation', '', 3, 'ri:briefcase-4-line', 1, 1, '/operation/shop', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(301, 300, 0, '门店管理', 'ShopList', '/operation/shop', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(302, 300, 0, '设备管理', 'DeviceList', '/operation/device', '', 2, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(303, 300, 0, '门店分布地图', 'DistributionMap', '/operation/distribution-map', '', 3, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(304, 300, 0, '补货员管理', 'ReplenisherList', '/operation/replenisher', '', 4, 1, 0);

-- =====================================================
-- 4. 商品管理 (Product) - rank 4
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(400, 0, 0, '商品管理', 'Product', '/product', '', 4, 'ri:inbox-line', 1, 1, '/product/list', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(401, 400, 0, '商品列表', 'ProductList', '/product/list', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(402, 400, 0, '新品申请', 'NewProductApply', '/product/new-apply', '', 2, 1, 0);

-- =====================================================
-- 5. 库存管理 (Inventory) - rank 5
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(500, 0, 0, '库存管理', 'Inventory', '/inventory', '', 5, 'ri:stack-line', 1, 1, '/inventory/list', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(501, 500, 0, '库存列表', 'InventoryList', '/inventory/list', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(502, 500, 0, '库存变动', 'InventoryLogs', '/inventory/logs', '', 2, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(503, 500, 0, '上货记录', 'StockRecords', '/inventory/records', '', 3, 1, 0);

-- =====================================================
-- 6. 客户管理 (Customer) - rank 6
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(600, 0, 0, '客户管理', 'Customer', '/customer', '', 6, 'ri:user-heart-line', 1, 1, '/customer/list', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(601, 600, 0, '客户列表', 'CustomerList', '/customer/list', '', 1, 1, 0);

-- =====================================================
-- 7. 分销管理 (Distribution) - rank 6
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(700, 0, 0, '分销管理', 'Distribution', '/distribution', '', 6, 'ep:share', 1, 1, '/distribution/dashboard', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(701, 700, 0, '分销概览', 'DistributionDashboard', '/distribution/dashboard', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(702, 700, 0, '分销员管理', 'DistributionDistributor', '/distribution/distributor', '', 2, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(703, 700, 0, '推荐记录', 'DistributionReferral', '/distribution/referral', '', 3, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(704, 700, 0, '佣金记录', 'DistributionCommission', '/distribution/commission', '', 4, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(705, 700, 0, '提现管理', 'DistributionWithdrawal', '/distribution/withdrawal', '', 5, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(706, 700, 0, '月度报表', 'DistributionReport', '/distribution/report', '', 6, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(707, 700, 0, '分销配置', 'DistributionConfig', '/distribution/config', '', 7, 1, 0);

-- =====================================================
-- 8. 营销中心 (Marketing) - rank 7
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(800, 0, 0, '营销中心', 'Marketing', '/marketing', '', 7, 'ri:megaphone-line', 1, 1, '/marketing/activity', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(801, 800, 0, '活动管理', 'MarketingActivity', '/marketing/activity', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(802, 800, 0, '优惠券管理', 'MarketingCoupon', '/marketing/coupon', '', 2, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(803, 800, 0, '用户优惠券', 'UserCouponList', '/marketing/user-coupon', '', 3, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(804, 800, 0, '定时折扣', 'TimedDiscount', '/marketing/timed-discount', '', 4, 1, 0);

-- 8.5 营销中心 → 数据统计 (三级菜单)
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(810, 800, 0, '数据统计', 'MarketingStatistics', '/marketing/statistics', '', 5, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(811, 810, 0, '统计概览', 'StatisticsOverview', '/marketing/statistics/overview', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(812, 810, 0, '活动统计', 'ActivityStatistics', '/marketing/statistics/activity', '', 2, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(813, 810, 0, '优惠券统计', 'CouponStatistics', '/marketing/statistics/coupon', '', 3, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(814, 810, 0, '趋势分析', 'TrendAnalysis', '/marketing/statistics/trend', '', 4, 1, 0);

-- =====================================================
-- 9. 统计报表 (Statistics) - rank 8
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(900, 0, 0, '统计报表', 'Statistics', '/statistics', '', 8, 'ri:bar-chart-grouped-line', 1, 1, '/statistics/overview', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(901, 900, 0, '统计概览', 'StatisticsOverview', '/statistics/overview', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(902, 900, 0, '品类销售统计', 'CategoryStatistics', '/statistics/category', '', 2, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(903, 900, 0, '门店利润报表', 'ProfitStatistics', '/statistics/profit', '', 3, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(904, 900, 0, '用户复购统计', 'RepurchaseStatistics', '/statistics/repurchase', '', 4, 1, 0);

-- =====================================================
-- 10. 系统设置 (System) - rank 8
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
(1000, 0, 0, '系统设置', 'System', '/system', '', 8, 'ri:settings-3-line', 1, 1, '/system/admin', 1);

INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(1001, 1000, 0, '管理员管理', 'SystemAdmin', '/system/admin', '', 1, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(1002, 1000, 0, '角色管理', 'SystemRole', '/system/role', '', 2, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(1003, 1000, 0, '权限管理', 'SystemPermission', '/system/permission', '', 3, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(1004, 1000, 0, '公告管理', 'SystemAnnouncement', '/system/announcement', '', 4, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(1005, 1000, 0, '操作日志', 'SystemOperationLog', '/system/operation-log', '', 5, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(1006, 1000, 0, '数据同步', 'SyncRecords', '/system/sync', '', 6, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(1007, 1000, 0, '字典管理', 'SystemDict', '/system/dict', '', 7, 1, 0);
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
(1008, 1000, 0, '菜单管理', 'SystemMenu', '/system/menu', '', 8, 1, 0);

-- =====================================================
-- 11. 设备层模版管理 (Layer Template) - rank 8
-- =====================================================
INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, keep_alive) VALUES
(1100, 0, 0, '设备层模版管理', 'LayerTemplate', '/layer-template', '', 8, 'ri:stack-line', 1, 0, 1);

-- =====================================================
-- 角色菜单关联：admin 角色（role_id=1）拥有所有菜单
-- =====================================================
INSERT INTO t_role_menu (id, role_id, menu_id) VALUES
(90001, 1, 100), (90002, 1, 101),
(90003, 1, 200), (90004, 1, 201), (90005, 1, 202),
(90006, 1, 300), (90007, 1, 301), (90008, 1, 302), (90009, 1, 303), (90010, 1, 304),
(90011, 1, 400), (90012, 1, 401), (90013, 1, 402),
(90014, 1, 500), (90015, 1, 501), (90016, 1, 502), (90017, 1, 503),
(90018, 1, 600), (90019, 1, 601),
(90020, 1, 700), (90021, 1, 701), (90022, 1, 702), (90023, 1, 703), (90024, 1, 704), (90025, 1, 705), (90026, 1, 706), (90027, 1, 707),
(90028, 1, 800), (90029, 1, 801), (90030, 1, 802), (90031, 1, 803), (90032, 1, 804),
(90033, 1, 810), (90034, 1, 811), (90035, 1, 812), (90036, 1, 813), (90037, 1, 814),
(90038, 1, 900), (90039, 1, 901), (90040, 1, 902), (90041, 1, 903), (90042, 1, 904),
(90043, 1, 1000), (90044, 1, 1001), (90045, 1, 1002), (90046, 1, 1003), (90047, 1, 1004), (90048, 1, 1005), (90049, 1, 1006), (90050, 1, 1007), (90051, 1, 1008),
(90052, 1, 1100);
