diff --git a/yudao-module-education/src/main/resources/db/migration/education/V4467__remove_education_duplicate_menus.sql b/yudao-module-education/src/main/resources/db/migration/education/V4467__remove_education_duplicate_menus.sql new file mode 100644 index 00000000..729c2cb0 --- /dev/null +++ b/yudao-module-education/src/main/resources/db/migration/education/V4467__remove_education_duplicate_menus.sql @@ -0,0 +1,53 @@ +-- 教育管理子树只保留教育自身菜单;移除复制的支付/商城/系统菜单, +-- 相关页面继续通过顶层"支付管理""商城系统""系统管理-三方登录"访问。 +DO $$ +DECLARE + remaining INTEGER; +BEGIN + IF to_regclass('system_menu') IS NULL THEN + RETURN; + END IF; + + -- 先清理角色授权引用,避免外键阻塞 + IF to_regclass('system_role_menu') IS NOT NULL THEN + DELETE FROM system_role_menu + WHERE menu_id IN ( + 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, + 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, + 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6920, 6921, 6922, 6923, 6924, 6925, + 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934, 6935, 6936, 6937, 6938, 6939, + 6940, 6941, 6942, 6943, 6944, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, + 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6970, 6971, 6972, 6973, 6974, + 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6990, 6991, 6992, 6993, 6994, 6995, + 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7010, 7011, 7012, + 7013, 7014, 7015, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, + 7031, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048, 7049, 7050, 7051, 7060, + 7061, 7062, 7063, 7064, 7065, 7066, 7067 + ); + END IF; + + DELETE FROM system_menu + WHERE id IN ( + 6867, 6868, 6869, 6870, 6871, 6872, 6873, 6874, 6875, 6876, 6877, 6878, 6879, 6880, + 6890, 6891, 6892, 6893, 6894, 6895, 6896, 6897, 6898, 6899, 6900, 6901, 6902, 6903, + 6904, 6905, 6906, 6907, 6908, 6909, 6910, 6911, 6920, 6921, 6922, 6923, 6924, 6925, + 6926, 6927, 6928, 6929, 6930, 6931, 6932, 6933, 6934, 6935, 6936, 6937, 6938, 6939, + 6940, 6941, 6942, 6943, 6944, 6950, 6951, 6952, 6953, 6954, 6955, 6956, 6957, 6958, + 6959, 6960, 6961, 6962, 6963, 6964, 6965, 6966, 6967, 6970, 6971, 6972, 6973, 6974, + 6975, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6990, 6991, 6992, 6993, 6994, 6995, + 6996, 6997, 6998, 6999, 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7010, 7011, 7012, + 7013, 7014, 7015, 7020, 7021, 7022, 7023, 7024, 7025, 7026, 7027, 7028, 7029, 7030, + 7031, 7040, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048, 7049, 7050, 7051, 7060, + 7061, 7062, 7063, 7064, 7065, 7066, 7067 + ); + + -- 校验:教育根下仅保留 14 个教育自有二级菜单 + SELECT count(*) INTO remaining + FROM system_menu + WHERE deleted = false AND parent_id = 6800 + AND id IN (6817, 6818, 6819, 6820, 6832, 6837, 6842, 6843, 6844, 6846, 6849, 6853, 6858, 6862, 6881); + IF remaining <> 15 THEN + RAISE EXCEPTION 'Education menu cleanup unexpected state: %', remaining USING ERRCODE = '23505'; + END IF; +END; +$$; diff --git a/yudao-module-education/src/main/resources/db/migration/education/V4468__add_tenant_id_to_missing_tables.sql b/yudao-module-education/src/main/resources/db/migration/education/V4468__add_tenant_id_to_missing_tables.sql new file mode 100644 index 00000000..cd75ea14 --- /dev/null +++ b/yudao-module-education/src/main/resources/db/migration/education/V4468__add_tenant_id_to_missing_tables.sql @@ -0,0 +1,22 @@ +-- 租户拦截器会对所有未忽略的表自动注入 tenant_id 条件, +-- V4462-V4464 新建的 BaseDO 表缺少该列,导致查询报 column "tenant_id" does not exist。 +DO $$ +DECLARE + r record; +BEGIN + FOR r IN SELECT unnest(ARRAY[ + 'member_address', 'member_config', 'member_group', 'member_level', + 'member_level_record', 'member_experience_record', 'member_point_record', + 'member_sign_in_config', 'member_sign_in_record', 'member_tag', + 'promotion_article', 'promotion_article_category', 'promotion_banner', + 'promotion_diy_page', 'promotion_diy_template', 'promotion_kefu_conversation', + 'promotion_kefu_message', 'promotion_point_activity', 'promotion_point_product', + 'pay_demo_order', 'pay_demo_withdraw' + ]) AS tbl + LOOP + IF to_regclass(r.tbl) IS NOT NULL THEN + EXECUTE format('ALTER TABLE %I ADD COLUMN IF NOT EXISTS tenant_id BIGINT NOT NULL DEFAULT 0', r.tbl); + END IF; + END LOOP; +END; +$$;