-- =====================================================================
-- 订餐管理菜单显示修复脚本
-- 适用场景：已执行 food_menu_permission.sql 后，部分订餐菜单在前端不显示。
-- 说明：刷新订餐管理菜单的显示状态、父子关系、路径和组件字段；不删除任何菜单和权限。
-- =====================================================================

UPDATE sys_menu_info
   SET menu_name = '订餐管理', menu_short_name = '订餐管理',
       menu_path = '/business/food', component = '',
       menu_parent_id = '0', menu_parent_ids = '0,',
       menu_icon = 'Bowl', sort_num = 30, menu_type = '1',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000000';

UPDATE sys_menu_info
   SET menu_name = '美食门店', menu_short_name = '美食门店',
       menu_path = '/business/food/restaurant', component = 'business/views/food/restaurant/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Shop', sort_num = 10, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000010';

UPDATE sys_menu_info
   SET menu_name = '菜品管理', menu_short_name = '菜品管理',
       menu_path = '/business/food/dish', component = 'business/views/food/dish/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Dish', sort_num = 20, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000020';

UPDATE sys_menu_info
   SET menu_name = '套餐管理', menu_short_name = '套餐管理',
       menu_path = '/business/food/package', component = 'business/views/food/package/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Goods', sort_num = 30, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000030';

UPDATE sys_menu_info
   SET menu_name = '订餐规则', menu_short_name = '订餐规则',
       menu_path = '/business/food/mealRule', component = 'business/views/food/mealRule/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Setting', sort_num = 40, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000040';

UPDATE sys_menu_info
   SET menu_name = '订餐菜单', menu_short_name = '订餐菜单',
       menu_path = '/business/food/mealMenu', component = 'business/views/food/mealMenu/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Menu', sort_num = 50, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000050';

UPDATE sys_menu_info
   SET menu_name = '订餐订单', menu_short_name = '订餐订单',
       menu_path = '/business/food/mealOrder', component = 'business/views/food/mealOrder/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Tickets', sort_num = 60, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000060';

UPDATE sys_menu_info
   SET menu_name = '美食预订', menu_short_name = '美食预订',
       menu_path = '/business/food/booking', component = 'business/views/food/booking/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Calendar', sort_num = 70, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000070';

UPDATE sys_menu_info
   SET menu_name = '订餐统计', menu_short_name = '订餐统计',
       menu_path = '/business/food/statistics', component = 'business/views/food/statistics/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'DataAnalysis', sort_num = 80, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000080';

UPDATE sys_menu_info
   SET menu_name = '订餐服务区域', menu_short_name = '服务区域',
       menu_path = '/business/food/mealServiceArea', component = 'business/views/food/mealServiceArea/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Location', sort_num = 35, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000090';

UPDATE sys_menu_info
   SET menu_name = '菜单模板', menu_short_name = '菜单模板',
       menu_path = '/business/food/mealMenuTemplate', component = 'business/views/food/mealMenuTemplate/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Document', sort_num = 45, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000091';

-- 追加企业团餐后台菜单，使用幂等片段，避免重复执行产生重复数据。
INSERT INTO sys_menu_info (
    id, create_by, create_date, update_by, update_date, remarks, del_flag, organize_id, tenant_id, tenant_code,
    sort_num, menu_name, menu_short_name, menu_path, target, menu_parent_ids, menu_parent_id, menu_icon, is_show,
    permission, menu_type, tip, subsystem_id, category, class_path, component, verification
)
SELECT '2005000000000000092', '1', NOW(), '1', NOW(), NULL, '0', NULL, '1', '1',
    25, '订餐企业', '订餐企业', '/business/food/company', '', '0,2005000000000000000,', '2005000000000000000', 'OfficeBuilding', '1',
    '', '2', '', '1820814889969582082', 'WEB', '', 'business/views/food/company/index', '0'
FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_info WHERE id = '2005000000000000092');

INSERT INTO sys_menu_info (
    id, create_by, create_date, update_by, update_date, remarks, del_flag, organize_id, tenant_id, tenant_code,
    sort_num, menu_name, menu_short_name, menu_path, target, menu_parent_ids, menu_parent_id, menu_icon, is_show,
    permission, menu_type, tip, subsystem_id, category, class_path, component, verification
)
SELECT '2005000000000000093', '1', NOW(), '1', NOW(), NULL, '0', NULL, '1', '1',
    27, '企业人员', '企业人员', '/business/food/companyEmployee', '', '0,2005000000000000000,', '2005000000000000000', 'User', '1',
    '', '2', '', '1820814889969582082', 'WEB', '', 'business/views/food/companyEmployee/index', '0'
FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_info WHERE id = '2005000000000000093');

INSERT INTO sys_menu_info (
    id, create_by, create_date, update_by, update_date, remarks, del_flag, organize_id, tenant_id, tenant_code,
    sort_num, menu_name, menu_short_name, menu_path, target, menu_parent_ids, menu_parent_id, menu_icon, is_show,
    permission, menu_type, tip, subsystem_id, category, class_path, component, verification
)
SELECT '2005000000000000094', '1', NOW(), '1', NOW(), NULL, '0', NULL, '1', '1',
    28, '加入审批', '加入审批', '/business/food/companyJoinApply', '', '0,2005000000000000000,', '2005000000000000000', 'Edit', '1',
    '', '2', '', '1820814889969582082', 'WEB', '', 'business/views/food/companyJoinApply/index', '0'
FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_info WHERE id = '2005000000000000094');

UPDATE sys_menu_info
   SET menu_name = '订餐企业', menu_short_name = '订餐企业',
       menu_path = '/business/food/company', component = 'business/views/food/company/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'OfficeBuilding', sort_num = 25, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000092';

UPDATE sys_menu_info
   SET menu_name = '企业人员', menu_short_name = '企业人员',
       menu_path = '/business/food/companyEmployee', component = 'business/views/food/companyEmployee/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'User', sort_num = 27, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000093';

UPDATE sys_menu_info
   SET menu_name = '加入审批', menu_short_name = '加入审批',
       menu_path = '/business/food/companyJoinApply', component = 'business/views/food/companyJoinApply/index',
       menu_parent_id = '2005000000000000000', menu_parent_ids = '0,2005000000000000000,',
       menu_icon = 'Edit', sort_num = 28, menu_type = '2',
       is_show = '1', permission = '', del_flag = '0', update_by = '1', update_date = NOW()
 WHERE id = '2005000000000000094';

INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001111', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:company:list', '列表', '1', '2005000000000000092', 10, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001111');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001112', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:company:info', '详情', '1', '2005000000000000092', 20, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001112');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001113', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:company:search', '搜索', '1', '2005000000000000092', 25, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001113');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001114', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:company:save', '保存', '1', '2005000000000000092', 30, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001114');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001115', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:company:status', '启停', '1', '2005000000000000092', 40, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001115');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001116', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:company:delete', '删除', '1', '2005000000000000092', 50, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001116');

INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001121', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyEmployee:list', '列表', '1', '2005000000000000093', 10, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001121');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001122', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyEmployee:info', '详情', '1', '2005000000000000093', 20, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001122');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001123', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyEmployee:save', '保存', '1', '2005000000000000093', 30, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001123');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001124', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyEmployee:freeze', '冻结', '1', '2005000000000000093', 40, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001124');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001125', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyEmployee:restore', '恢复', '1', '2005000000000000093', 50, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001125');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001126', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyEmployee:unbind', '解绑', '1', '2005000000000000093', 55, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001126');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001127', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyEmployee:delete', '删除', '1', '2005000000000000093', 60, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001127');

INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001131', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyJoinApply:list', '列表', '1', '2005000000000000094', 10, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001131');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001132', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyJoinApply:info', '详情', '1', '2005000000000000094', 20, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001132');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001133', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyJoinApply:approve', '审批通过', '1', '2005000000000000094', 30, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001133');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001134', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyJoinApply:reject', '审批拒绝', '1', '2005000000000000094', 40, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001134');
INSERT INTO sys_menu_button_info (id, create_date, create_by, update_date, update_by, del_flag, tenant_id, tenant_code, button_code, button_name, enable, menu_id, sort_num, sys_data, source)
SELECT '2005000000000001135', NOW(), '1', NOW(), '1', '0', '1', '1', 'manager:business:food:companyJoinApply:delete', '删除', '1', '2005000000000000094', 50, '0', '0' FROM dual WHERE NOT EXISTS (SELECT 1 FROM sys_menu_button_info WHERE id = '2005000000000001135');
