fix_tenant_sys_menu_other_parent.sql 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. -- Create visible top-level "????" parent and move archived hidden menus under it.
  2. -- Replaces hidden archive root 32333 as the grouping parent for maintenance UI.
  3. -- Ensure parent exists (idempotent; menu_name via Python post_process if re-run)
  4. INSERT INTO tenant_sys_menu
  5. (menu_id, menu_name, parent_id, order_num, path, component, query,
  6. is_frame, is_cache, menu_type, visible, status, perms, icon,
  7. create_by, create_time, remark)
  8. SELECT 35300, '????', 0, 17, 'other', NULL, NULL,
  9. 1, 0, 'M', '0', '0', NULL, 'more',
  10. 'admin', NOW(), '[organize:other-parent]'
  11. FROM DUAL
  12. WHERE NOT EXISTS (SELECT 1 FROM tenant_sys_menu WHERE menu_id = 35300);
  13. UPDATE tenant_sys_menu
  14. SET menu_name = '????', parent_id = 0, order_num = 17, path = 'other',
  15. menu_type = 'M', visible = '0', status = '0', icon = 'more'
  16. WHERE menu_id = 35300;
  17. -- Move former platform archive children -> ????
  18. UPDATE tenant_sys_menu SET parent_id = 35300 WHERE parent_id = 32333;
  19. -- Keep legacy platform root hidden and empty (historical menu_id)
  20. UPDATE tenant_sys_menu
  21. SET parent_id = 0, visible = '1', status = '0', order_num = 99
  22. WHERE menu_id = 32333;
  23. -- Show entire subtree under ÆäËû (maintenance bucket; was hidden before grouping)
  24. UPDATE tenant_sys_menu
  25. SET visible = '0', status = '0'
  26. WHERE menu_id IN (
  27. WITH RECURSIVE other_tree AS (
  28. SELECT menu_id FROM tenant_sys_menu WHERE parent_id = 35300
  29. UNION ALL
  30. SELECT m.menu_id
  31. FROM tenant_sys_menu m
  32. INNER JOIN other_tree t ON m.parent_id = t.menu_id
  33. )
  34. SELECT menu_id FROM other_tree
  35. );