-- Menu configuration only. No automatic grants to roles or users, and no business data changes. -- /index remains a constant route; its menu record participates in role authorization. INSERT INTO sys_menu(menu_name,parent_id,order_num,path,component,is_frame,is_cache,menu_type,visible,status,perms,icon,create_by,create_time) SELECT '首页',0,0,'index','businessHome/index',1,0,'C','0','0','business:home:view','dashboard','admin',now() WHERE NOT EXISTS(SELECT 1 FROM sys_menu WHERE perms='business:home:view'); INSERT INTO sys_menu(menu_name,parent_id,order_num,path,is_frame,is_cache,menu_type,visible,status,perms,icon,create_by,create_time) SELECT v.label,p.menu_id,v.sort_order,'',1,0,'F','0','0',v.permission,'#','admin',now() FROM sys_menu p JOIN ( SELECT '首页库存统计' label,1 sort_order,'business:home:warehouse' permission UNION ALL SELECT '首页项目及经费统计',2,'business:home:project' UNION ALL SELECT '首页业务待办',3,'business:home:todo' ) v WHERE p.perms='business:home:view' AND NOT EXISTS(SELECT 1 FROM sys_menu x WHERE x.perms=v.permission);