diff --git a/backend/app/admin/api/v1/sys/menu.py b/backend/app/admin/api/v1/sys/menu.py index 6e1aaaa39..43780a576 100644 --- a/backend/app/admin/api/v1/sys/menu.py +++ b/backend/app/admin/api/v1/sys/menu.py @@ -14,7 +14,7 @@ router = APIRouter() -@router.get('/sidebar', summary='获取用户侧边栏', dependencies=[DependsJwtAuth]) +@router.get('/sidebar', summary='获取用户菜单侧边栏', description='适配 vben5', dependencies=[DependsJwtAuth]) async def get_user_sidebar(request: Request) -> ResponseSchemaModel[list[dict[str, Any]]]: menu = await menu_service.get_user_menu_tree(request=request) return response_base.success(data=menu) diff --git a/backend/app/admin/crud/crud_menu.py b/backend/app/admin/crud/crud_menu.py index c66d0b004..51bd3fdcd 100644 --- a/backend/app/admin/crud/crud_menu.py +++ b/backend/app/admin/crud/crud_menu.py @@ -60,7 +60,7 @@ async def get_role_menus(self, db: AsyncSession, superuser: bool, menu_ids: list :return: """ stmt = select(self.model).order_by(asc(self.model.sort)) - filters = [self.model.menu_type.in_([0, 1])] + filters = [self.model.type.in_([0, 1])] if not superuser: filters.append(self.model.id.in_(menu_ids)) stmt = stmt.where(and_(*filters)) diff --git a/backend/app/admin/model/menu.py b/backend/app/admin/model/menu.py index 6d74ec2e6..15d8257ea 100644 --- a/backend/app/admin/model/menu.py +++ b/backend/app/admin/model/menu.py @@ -24,15 +24,18 @@ class Menu(Base): id: Mapped[id_key] = mapped_column(init=False) title: Mapped[str] = mapped_column(String(50), comment='菜单标题') name: Mapped[str] = mapped_column(String(50), comment='菜单名称') + path: Mapped[str] = mapped_column(String(200), comment='路由地址') sort: Mapped[int] = mapped_column(default=0, comment='排序') icon: Mapped[str | None] = mapped_column(String(100), default=None, comment='菜单图标') - path: Mapped[str | None] = mapped_column(String(200), default=None, comment='路由地址') - menu_type: Mapped[int] = mapped_column(default=0, comment='菜单类型(0目录 1菜单 2按钮)') + type: Mapped[int] = mapped_column(default=0, comment='菜单类型(0目录 1菜单 2按钮)') component: Mapped[str | None] = mapped_column(String(255), default=None, comment='组件路径') perms: Mapped[str | None] = mapped_column(String(100), default=None, comment='权限标识') status: Mapped[int] = mapped_column(default=1, comment='菜单状态(0停用 1正常)') display: Mapped[int] = mapped_column(default=1, comment='是否显示(0否 1是)') cache: Mapped[int] = mapped_column(default=1, comment='是否缓存(0否 1是)') + link: Mapped[str | None] = mapped_column( + LONGTEXT().with_variant(TEXT, 'postgresql'), default=None, comment='外链地址' + ) remark: Mapped[str | None] = mapped_column( LONGTEXT().with_variant(TEXT, 'postgresql'), default=None, comment='备注' ) diff --git a/backend/app/admin/schema/menu.py b/backend/app/admin/schema/menu.py index a23930f4a..97b7b3604 100644 --- a/backend/app/admin/schema/menu.py +++ b/backend/app/admin/schema/menu.py @@ -13,16 +13,17 @@ class MenuSchemaBase(SchemaBase): title: str = Field(description='菜单标题') name: str = Field(description='菜单名称') + path: str = Field(description='路由路径') parent_id: int | None = Field(None, description='菜单父级 ID') sort: int = Field(0, ge=0, description='排序') icon: str | None = Field(None, description='图标') - path: str | None = Field(None, description='路由路径') - menu_type: MenuType = Field(MenuType.directory, description='菜单类型(0目录 1菜单 2按钮)') + type: MenuType = Field(MenuType.directory, description='菜单类型(0目录 1菜单 2按钮)') component: str | None = Field(None, description='组件路径') perms: str | None = Field(None, description='权限标识') status: StatusType = Field(StatusType.enable, description='状态') display: StatusType = Field(StatusType.enable, description='是否显示') cache: StatusType = Field(StatusType.enable, description='是否缓存') + link: str | None = Field(None, description='外链地址') remark: str | None = Field(None, description='备注') diff --git a/backend/app/admin/service/menu_service.py b/backend/app/admin/service/menu_service.py index 12dd959be..22b94c23b 100644 --- a/backend/app/admin/service/menu_service.py +++ b/backend/app/admin/service/menu_service.py @@ -12,7 +12,7 @@ from backend.core.conf import settings from backend.database.db import async_db_session from backend.database.redis import redis_client -from backend.utils.build_tree import get_tree_data +from backend.utils.build_tree import get_tree_data, get_vben5_tree_data class MenuService: @@ -79,7 +79,7 @@ async def get_user_menu_tree(*, request: Request) -> list[dict[str, Any]]: for role in roles: menu_ids.extend([menu.id for menu in role.menus]) menu_select = await menu_dao.get_role_menus(db, request.user.is_superuser, menu_ids) - menu_tree = get_tree_data(menu_select) + menu_tree = get_vben5_tree_data(menu_select) return menu_tree @staticmethod diff --git a/backend/sql/mysql/create_tables.sql b/backend/sql/mysql/create_tables.sql index f49d1aaad..112497b8c 100644 --- a/backend/sql/mysql/create_tables.sql +++ b/backend/sql/mysql/create_tables.sql @@ -1,39 +1,41 @@ create table sys_api ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, - name varchar(50) not null comment 'api名称', + name varchar(50) not null comment 'API 名称', method varchar(16) not null comment '请求方法', - path varchar(500) not null comment 'api路径', + path varchar(500) not null comment 'API 路径', remark longtext null comment '备注', created_time datetime not null comment '创建时间', updated_time datetime null comment '更新时间', constraint name unique (name) -); +) + comment 'API 表'; create index ix_sys_api_id on sys_api (id); create table sys_casbin_rule ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, ptype varchar(255) not null comment '策略类型: p / g', - v0 varchar(255) not null comment '角色ID / 用户uuid', - v1 longtext not null comment 'api路径 / 角色名称', + v0 varchar(255) not null comment '用户 UUID / 角色 ID', + v1 longtext not null comment 'API 路径 / 角色名称', v2 varchar(255) null comment '请求方法', - v3 varchar(255) null, - v4 varchar(255) null, - v5 varchar(255) null -); + v3 varchar(255) null comment '预留字段', + v4 varchar(255) null comment '预留字段', + v5 varchar(255) null comment '预留字段' +) + comment 'Casbin 规则表'; create index ix_sys_casbin_rule_id on sys_casbin_rule (id); create table sys_config ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, name varchar(20) not null comment '名称', type varchar(20) null comment '类型', @@ -45,14 +47,15 @@ create table sys_config updated_time datetime null comment '更新时间', constraint `key` unique (`key`) -); +) + comment '参数配置表'; create index ix_sys_config_id on sys_config (id); create table sys_data_rule ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, name varchar(255) not null comment '规则名称', model varchar(50) not null comment 'SQLA 模型类', @@ -64,14 +67,15 @@ create table sys_data_rule updated_time datetime null comment '更新时间', constraint name unique (name) -); +) + comment '数据权限规则表'; create index ix_sys_data_rule_id on sys_data_rule (id); create table sys_dept ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, name varchar(50) not null comment '部门名称', sort int not null comment '排序', @@ -86,7 +90,8 @@ create table sys_dept constraint sys_dept_ibfk_1 foreign key (parent_id) references sys_dept (id) on delete set null -); +) + comment '部门表'; create index ix_sys_dept_id on sys_dept (id); @@ -96,7 +101,7 @@ create index ix_sys_dept_parent_id create table sys_dict_type ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, name varchar(32) not null comment '字典类型名称', code varchar(32) not null comment '字典类型编码', @@ -108,11 +113,12 @@ create table sys_dict_type unique (code), constraint name unique (name) -); +) + comment '字典类型表'; create table sys_dict_data ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, label varchar(32) not null comment '字典标签', value varchar(32) not null comment '字典值', @@ -129,7 +135,8 @@ create table sys_dict_data constraint sys_dict_data_ibfk_1 foreign key (type_id) references sys_dict_type (id) on delete cascade -); +) + comment '字典数据表'; create index ix_sys_dict_data_id on sys_dict_data (id); @@ -142,7 +149,7 @@ create index ix_sys_dict_type_id create table sys_gen_business ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, app_name varchar(50) not null comment '应用名称(英文)', table_name_en varchar(255) not null comment '表名称(英文)', @@ -158,14 +165,15 @@ create table sys_gen_business updated_time datetime null comment '更新时间', constraint table_name_en unique (table_name_en) -); +) + comment '代码生成业务表'; create index ix_sys_gen_business_id on sys_gen_business (id); create table sys_gen_model ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, name varchar(50) not null comment '列名称', comment varchar(255) null comment '列描述', @@ -180,7 +188,8 @@ create table sys_gen_model constraint sys_gen_model_ibfk_1 foreign key (gen_business_id) references sys_gen_business (id) on delete cascade -); +) + comment '代码生成模型表'; create index gen_business_id on sys_gen_model (gen_business_id); @@ -190,7 +199,7 @@ create index ix_sys_gen_model_id create table sys_login_log ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, user_uuid varchar(50) not null comment '用户UUID', username varchar(20) not null comment '用户名', @@ -206,26 +215,28 @@ create table sys_login_log msg longtext not null comment '提示消息', login_time datetime not null comment '登录时间', created_time datetime not null comment '创建时间' -); +) + comment '登录日志表'; create index ix_sys_login_log_id on sys_login_log (id); create table sys_menu ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, title varchar(50) not null comment '菜单标题', name varchar(50) not null comment '菜单名称', + path varchar(200) not null comment '路由地址', sort int not null comment '排序', icon varchar(100) null comment '菜单图标', - path varchar(200) null comment '路由地址', - menu_type int not null comment '菜单类型(0目录 1菜单 2按钮)', + type int not null comment '菜单类型(0目录 1菜单 2按钮)', component varchar(255) null comment '组件路径', perms varchar(100) null comment '权限标识', status int not null comment '菜单状态(0停用 1正常)', display int not null comment '是否显示(0否 1是)', cache int not null comment '是否缓存(0否 1是)', + link longtext null comment '外链地址', remark longtext null comment '备注', parent_id int null comment '父菜单ID', created_time datetime not null comment '创建时间', @@ -233,7 +244,8 @@ create table sys_menu constraint sys_menu_ibfk_1 foreign key (parent_id) references sys_menu (id) on delete set null -); +) + comment '菜单表'; create index ix_sys_menu_id on sys_menu (id); @@ -241,9 +253,27 @@ create index ix_sys_menu_id create index ix_sys_menu_parent_id on sys_menu (parent_id); +create table sys_notice +( + id int auto_increment comment '主键 ID' + primary key, + title varchar(50) not null comment '标题', + type int not null comment '类型(0:通知、1:公告)', + author varchar(16) not null comment '作者', + source varchar(50) not null comment '信息来源', + status int not null comment '状态(0:隐藏、1:显示)', + content longtext not null comment '内容', + created_time datetime not null comment '创建时间', + updated_time datetime null comment '更新时间' +) + comment '系统通知公告表'; + +create index ix_sys_notice_id + on sys_notice (id); + create table sys_opera_log ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, trace_id varchar(32) not null comment '请求跟踪 ID', username varchar(20) null comment '用户名', @@ -265,14 +295,15 @@ create table sys_opera_log cost_time float not null comment '请求耗时(ms)', opera_time datetime not null comment '操作时间', created_time datetime not null comment '创建时间' -); +) + comment '操作日志表'; create index ix_sys_opera_log_id on sys_opera_log (id); create table sys_role ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, name varchar(20) not null comment '角色名称', status int not null comment '角色状态(0停用 1正常)', @@ -281,7 +312,8 @@ create table sys_role updated_time datetime null comment '更新时间', constraint name unique (name) -); +) + comment '角色表'; create index ix_sys_role_id on sys_role (id); @@ -332,7 +364,7 @@ create index role_id create table sys_user ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, uuid varchar(50) not null, username varchar(20) not null comment '用户名', @@ -362,7 +394,8 @@ create table sys_user constraint sys_user_ibfk_1 foreign key (dept_id) references sys_dept (id) on delete set null -); +) + comment '用户表'; create index dept_id on sys_user (dept_id); @@ -370,6 +403,9 @@ create index dept_id create index ix_sys_user_id on sys_user (id); +create index ix_sys_user_status + on sys_user (status); + create table sys_user_role ( id int auto_increment comment '主键ID', @@ -394,7 +430,7 @@ create index user_id create table sys_user_social ( - id int auto_increment comment '主键id' + id int auto_increment comment '主键 ID' primary key, source varchar(20) not null comment '第三方用户来源', open_id varchar(20) null comment '第三方用户的 open id', @@ -408,7 +444,8 @@ create table sys_user_social constraint sys_user_social_ibfk_1 foreign key (user_id) references sys_user (id) on delete set null -); +) + comment '用户社交表(OAuth2)'; create index ix_sys_user_social_id on sys_user_social (id); diff --git a/backend/sql/mysql/init_test_data.sql b/backend/sql/mysql/init_test_data.sql index 2d4db8785..178f08785 100644 --- a/backend/sql/mysql/init_test_data.sql +++ b/backend/sql/mysql/init_test_data.sql @@ -6,27 +6,28 @@ values (1, '创建API', 'POST', '/api/v1/apis', null, '2024-02-02 11:29:47', nu (2, '删除API', 'DELETE', '/api/v1/apis', null, '2024-02-02 11:31:32', null), (3, '编辑API', 'PUT', '/api/v1/apis/{pk}', null, '2024-02-02 11:32:22', null); -insert into sys_menu (id, title, name, sort, icon, path, menu_type, component, perms, status, display, cache, remark, parent_id, created_time, updated_time) -values (1, '测试', 'test', 0, '', null, 0, null, null, 0, 0, 1, null, null, '2023-07-27 19:14:10', null), - (2, '仪表盘', 'dashboard', 0, 'IconDashboard', 'dashboard', 0, null, null, 1, 1, 1, null, null, '2023-07-27 19:15:45', null), - (3, '工作台', 'Workplace', 0, null, 'workplace', 1, '/dashboard/workplace/index.vue', null, 1, 1, 1, null, 2, '2023-07-27 19:17:59', null), - (4, '系统管理', 'admin', 0, 'IconSettings', 'admin', 0, null, null, 1, 1, 1, null, null, '2023-07-27 19:23:00', null), - (5, '部门管理', 'SysDept', 0, null, 'sys-dept', 1, '/admin/dept/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:23:42', null), - (6, '用户管理', 'SysUser', 0, null, 'sys-user', 1, '/admin/user/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:25:13', null), - (7, '角色管理', 'SysRole', 0, null, 'sys-role', 1, '/admin/role/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:25:45', null), - (8, '菜单管理', 'SysMenu', 0, null, 'sys-menu', 1, '/admin/menu/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:45:29', null), - (9, 'API 管理', 'SysApi', 0, null, 'sys-api', 1, '/admin/api/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:24:12', null), - (10, '数据规则管理', 'SysDataRule', 0, null, 'sys-data-rule', 1, '/admin/data-rule/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:24:12', null), - (11, '系统自动化', 'automation', 0, 'IconCodeSquare', 'automation', 0, null, null, 1, 1, 1, null, null, '2024-07-27 02:06:20', '2024-07-27 02:18:52'), - (12, '代码生成', 'CodeGenerator', 0, null, 'code-generator', 1, '/automation/generator/index.vue', null, 1, 1, 1, null, 11, '2024-07-27 12:24:54', null), - (13, '系统监控', 'monitor', 0, 'IconComputer', 'monitor', 0, null, null, 1, 1, 1, null, null, '2023-07-27 19:27:08', null), - (14, 'Redis 监控', 'Redis', 0, null, 'redis', 1, '/monitor/redis/index.vue', 'sys:monitor:redis', 1, 1, 1, null, 13, '2023-07-27 19:28:03', null), - (15, '服务器监控', 'Server', 0, null, 'server', 1, '/monitor/server/index.vue', 'sys:monitor:server', 1, 1, 1, null, 13, '2023-07-27 19:28:29', null), - (16, '日志', 'log', 0, 'IconBug', 'log', 0, null, null, 1, 1, 1, null, null, '2023-07-27 19:19:59', null), - (17, '登录日志', 'Login', 0, null, 'login', 1, '/log/login/index.vue', null, 1, 1, 1, null, 16, '2023-07-27 19:20:56', null), - (18, '操作日志', 'Opera', 0, null, 'opera', 1, '/log/opera/index.vue', null, 1, 1, 1, null, 16, '2023-07-27 19:21:28', null), - (19, '官网', 'site', 998, 'IconComputer', 'https://fastapi-practices.github.io/fastapi_best_architecture_docs/', 1, null, null, 1, 1, 1, null, null, '2023-07-27 19:22:24', null), - (20, '赞助', 'sponsor', 999, 'IconFire', 'https://wu-clan.github.io/sponsor/', 1, null, null, 1, 1, 1, null, null, '2024-07-27 12:39:57', null); +insert into fba.sys_menu (id, title, name, path, sort, icon, type, component, perms, status, display, cache, link, remark, parent_id, created_time, updated_time) +values (1, '测试', 'test', '', 0, '', 0, null, null, 0, 0, 1, null, null, null, '2023-07-27 19:14:10', null), + (2, '仪表盘', 'Dashboard', 'dashboard', 0, 'material-symbols:dashboard', 0, null, null, 1, 1, 1, null, null, null, '2023-07-27 19:15:45', null), + (3, '工作台', 'Workspace', 'workspace', 0, null, 1, '/dashboard/workspace/index.vue', null, 1, 1, 1, null, null, 2, '2023-07-27 19:17:59', null), + (4, '数据分析', 'Analytics', 'analytics', 0, null, 1, '/dashboard/analytics/index.vue', null, 1, 1, 1, null, null, 2, '2023-07-27 19:17:59', null), + (5, '系统管理', 'Admin', 'admin', 0, 'eos-icons:admin', 0, null, null, 1, 1, 1, null, null, null, '2023-07-27 19:23:00', null), + (6, '部门管理', 'SysDept', 'sys-dept', 0, null, 1, '/admin/dept/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:23:42', null), + (7, '用户管理', 'SysUser', 'sys-user', 0, null, 1, '/admin/user/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:25:13', null), + (8, '角色管理', 'SysRole', 'sys-role', 0, null, 1, '/admin/role/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:25:45', null), + (9, '菜单管理', 'SysMenu', 'sys-menu', 0, null, 1, '/admin/menu/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:45:29', null), + (10, 'API 管理', 'SysApi', 'sys-api', 0, null, 1, '/admin/api/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:24:12', null), + (11, '数据规则管理', 'SysDataRule', 'sys-data-rule', 0, null, 1, '/admin/data-rule/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:24:12', null), + (12, '系统自动化', 'Automation', 'automation', 0, 'material-symbols:automation', 0, null, null, 1, 1, 1, null, null, null, '2024-07-27 02:06:20', null), + (13, '代码生成', 'CodeGenerator', 'code-generator', 0, null, 1, '/automation/code-generator/index.vue', null, 1, 1, 1, null, null, 12, '2024-07-27 12:24:54', null), + (14, '系统监控', 'Monitor', 'monitor', 0, 'mdi:monitor-eye', 0, null, null, 1, 1, 1, null, null, null, '2023-07-27 19:27:08', null), + (15, 'Redis 监控', 'Redis', 'redis', 0, null, 1, '/monitor/redis/index.vue', null, 1, 1, 1, null, null, 14, '2023-07-27 19:28:03', null), + (16, '服务器监控', 'Server', 'server', 0, null, 1, '/monitor/server/index.vue', null, 1, 1, 1, null, null, 14, '2023-07-27 19:28:29', null), + (17, '日志', 'Log', 'log', 0, 'carbon:cloud-logging', 0, null, null, 1, 1, 1, null, null, null, '2023-07-27 19:19:59', null), + (18, '登录日志', 'Login', 'login', 0, null, 1, '/log/login/index.vue', null, 1, 1, 1, null, null, 17, '2023-07-27 19:20:56', null), + (19, '操作日志', 'Opera', 'opera', 0, null, 1, '/log/opera/index.vue', null, 1, 1, 1, null, null, 17, '2023-07-27 19:21:28', null), + (20, '官网', 'Site', '', 998, 'dashicons:admin-site', 1, null, null, 1, 1, 1, 'https://fastapi-practices.github.io/fastapi_best_architecture_docs/', null, null, '2023-07-27 19:22:24', null), + (21, '赞助', 'Sponsor', '', 999, 'material-icon-theme:github-sponsors', 1, null, null, 1, 1, 1, 'https://wu-clan.github.io/sponsor/', null, null, '2024-07-27 12:39:57', null); insert into sys_role (id, name, status, remark, created_time, updated_time) values (1, 'test', 1, null, '2023-06-26 17:13:45', null); diff --git a/backend/sql/postgresql/create_tables.sql b/backend/sql/postgresql/create_tables.sql index 89693c255..e469a2f13 100644 --- a/backend/sql/postgresql/create_tables.sql +++ b/backend/sql/postgresql/create_tables.sql @@ -1,95 +1,3 @@ -create table sys_api -( - id serial - primary key, - name varchar(50) not null - unique, - method varchar(16) not null, - path varchar(500) not null, - remark text, - created_time timestamp with time zone not null, - updated_time timestamp with time zone -); - -comment on column sys_api.id is '主键id'; - -comment on column sys_api.name is 'api名称'; - -comment on column sys_api.method is '请求方法'; - -comment on column sys_api.path is 'api路径'; - -comment on column sys_api.remark is '备注'; - -comment on column sys_api.created_time is '创建时间'; - -comment on column sys_api.updated_time is '更新时间'; - -create index ix_sys_api_id - on sys_api (id); - -create table sys_casbin_rule -( - id serial - primary key, - ptype varchar(255) not null, - v0 varchar(255) not null, - v1 text not null, - v2 varchar(255), - v3 varchar(255), - v4 varchar(255), - v5 varchar(255) -); - -comment on column sys_casbin_rule.id is '主键id'; - -comment on column sys_casbin_rule.ptype is '策略类型: p / g'; - -comment on column sys_casbin_rule.v0 is '角色ID / 用户uuid'; - -comment on column sys_casbin_rule.v1 is 'api路径 / 角色名称'; - -comment on column sys_casbin_rule.v2 is '请求方法'; - -create index ix_sys_casbin_rule_id - on sys_casbin_rule (id); - -create table sys_config -( - id serial - primary key, - name varchar(20) not null, - type varchar(20), - key varchar(50) not null - unique, - value text not null, - is_frontend integer not null, - remark text, - created_time timestamp with time zone not null, - updated_time timestamp with time zone -); - -comment on column sys_config.id is '主键id'; - -comment on column sys_config.name is '名称'; - -comment on column sys_config.type is '类型'; - -comment on column sys_config.key is '键名'; - -comment on column sys_config.value is '键值'; - -comment on column sys_config.is_frontend is '是否前端'; - -comment on column sys_config.remark is '备注'; - -comment on column sys_config.created_time is '创建时间'; - -comment on column sys_config.updated_time is '更新时间'; - -create index ix_sys_config_id - on sys_config (id); - create table sys_data_rule ( id serial @@ -105,7 +13,9 @@ create table sys_data_rule updated_time timestamp with time zone ); -comment on column sys_data_rule.id is '主键id'; +comment on table sys_data_rule is '数据权限规则表'; + +comment on column sys_data_rule.id is '主键 ID'; comment on column sys_data_rule.name is '规则名称'; @@ -123,6 +33,9 @@ comment on column sys_data_rule.created_time is '创建时间'; comment on column sys_data_rule.updated_time is '更新时间'; +alter table sys_data_rule + owner to postgres; + create index ix_sys_data_rule_id on sys_data_rule (id); @@ -144,7 +57,9 @@ create table sys_dept updated_time timestamp with time zone ); -comment on column sys_dept.id is '主键id'; +comment on table sys_dept is '部门表'; + +comment on column sys_dept.id is '主键 ID'; comment on column sys_dept.name is '部门名称'; @@ -166,42 +81,14 @@ comment on column sys_dept.created_time is '创建时间'; comment on column sys_dept.updated_time is '更新时间'; -create index ix_sys_dept_id - on sys_dept (id); +alter table sys_dept + owner to postgres; create index ix_sys_dept_parent_id on sys_dept (parent_id); -create table sys_dict_type -( - id serial - primary key, - name varchar(32) not null - unique, - code varchar(32) not null - unique, - status integer not null, - remark text, - created_time timestamp with time zone not null, - updated_time timestamp with time zone -); - -comment on column sys_dict_type.id is '主键id'; - -comment on column sys_dict_type.name is '字典类型名称'; - -comment on column sys_dict_type.code is '字典类型编码'; - -comment on column sys_dict_type.status is '状态(0停用 1正常)'; - -comment on column sys_dict_type.remark is '备注'; - -comment on column sys_dict_type.created_time is '创建时间'; - -comment on column sys_dict_type.updated_time is '更新时间'; - -create index ix_sys_dict_type_id - on sys_dict_type (id); +create index ix_sys_dept_id + on sys_dept (id); create table sys_login_log ( @@ -223,7 +110,9 @@ create table sys_login_log created_time timestamp with time zone not null ); -comment on column sys_login_log.id is '主键id'; +comment on table sys_login_log is '登录日志表'; + +comment on column sys_login_log.id is '主键 ID'; comment on column sys_login_log.user_uuid is '用户UUID'; @@ -253,6 +142,9 @@ comment on column sys_login_log.login_time is '登录时间'; comment on column sys_login_log.created_time is '创建时间'; +alter table sys_login_log + owner to postgres; + create index ix_sys_login_log_id on sys_login_log (id); @@ -262,15 +154,16 @@ create table sys_menu primary key, title varchar(50) not null, name varchar(50) not null, + path varchar(200) not null, sort integer not null, icon varchar(100), - path varchar(200), - menu_type integer not null, + type integer not null, component varchar(255), perms varchar(100), status integer not null, display integer not null, cache integer not null, + link text, remark text, parent_id integer references sys_menu @@ -279,19 +172,21 @@ create table sys_menu updated_time timestamp with time zone ); -comment on column sys_menu.id is '主键id'; +comment on table sys_menu is '菜单表'; + +comment on column sys_menu.id is '主键 ID'; comment on column sys_menu.title is '菜单标题'; comment on column sys_menu.name is '菜单名称'; +comment on column sys_menu.path is '路由地址'; + comment on column sys_menu.sort is '排序'; comment on column sys_menu.icon is '菜单图标'; -comment on column sys_menu.path is '路由地址'; - -comment on column sys_menu.menu_type is '菜单类型(0目录 1菜单 2按钮)'; +comment on column sys_menu.type is '菜单类型(0目录 1菜单 2按钮)'; comment on column sys_menu.component is '组件路径'; @@ -303,6 +198,8 @@ comment on column sys_menu.display is '是否显示(0否 1是)'; comment on column sys_menu.cache is '是否缓存(0否 1是)'; +comment on column sys_menu.link is '外链地址'; + comment on column sys_menu.remark is '备注'; comment on column sys_menu.parent_id is '父菜单ID'; @@ -311,6 +208,9 @@ comment on column sys_menu.created_time is '创建时间'; comment on column sys_menu.updated_time is '更新时间'; +alter table sys_menu + owner to postgres; + create index ix_sys_menu_id on sys_menu (id); @@ -343,7 +243,9 @@ create table sys_opera_log created_time timestamp with time zone not null ); -comment on column sys_opera_log.id is '主键id'; +comment on table sys_opera_log is '操作日志表'; + +comment on column sys_opera_log.id is '主键 ID'; comment on column sys_opera_log.trace_id is '请求跟踪 ID'; @@ -385,6 +287,9 @@ comment on column sys_opera_log.opera_time is '操作时间'; comment on column sys_opera_log.created_time is '创建时间'; +alter table sys_opera_log + owner to postgres; + create index ix_sys_opera_log_id on sys_opera_log (id); @@ -400,7 +305,9 @@ create table sys_role updated_time timestamp with time zone ); -comment on column sys_role.id is '主键id'; +comment on table sys_role is '角色表'; + +comment on column sys_role.id is '主键 ID'; comment on column sys_role.name is '角色名称'; @@ -412,9 +319,201 @@ comment on column sys_role.created_time is '创建时间'; comment on column sys_role.updated_time is '更新时间'; +alter table sys_role + owner to postgres; + create index ix_sys_role_id on sys_role (id); +create table sys_api +( + id serial + primary key, + name varchar(50) not null + unique, + method varchar(16) not null, + path varchar(500) not null, + remark text, + created_time timestamp with time zone not null, + updated_time timestamp with time zone +); + +comment on table sys_api is 'API 表'; + +comment on column sys_api.id is '主键 ID'; + +comment on column sys_api.name is 'API 名称'; + +comment on column sys_api.method is '请求方法'; + +comment on column sys_api.path is 'API 路径'; + +comment on column sys_api.remark is '备注'; + +comment on column sys_api.created_time is '创建时间'; + +comment on column sys_api.updated_time is '更新时间'; + +alter table sys_api + owner to postgres; + +create index ix_sys_api_id + on sys_api (id); + +create table sys_casbin_rule +( + id serial + primary key, + ptype varchar(255) not null, + v0 varchar(255) not null, + v1 text not null, + v2 varchar(255), + v3 varchar(255), + v4 varchar(255), + v5 varchar(255) +); + +comment on table sys_casbin_rule is 'Casbin 规则表'; + +comment on column sys_casbin_rule.id is '主键 ID'; + +comment on column sys_casbin_rule.ptype is '策略类型: p / g'; + +comment on column sys_casbin_rule.v0 is '用户 UUID / 角色 ID'; + +comment on column sys_casbin_rule.v1 is 'API 路径 / 角色名称'; + +comment on column sys_casbin_rule.v2 is '请求方法'; + +comment on column sys_casbin_rule.v3 is '预留字段'; + +comment on column sys_casbin_rule.v4 is '预留字段'; + +comment on column sys_casbin_rule.v5 is '预留字段'; + +alter table sys_casbin_rule + owner to postgres; + +create index ix_sys_casbin_rule_id + on sys_casbin_rule (id); + +create table sys_config +( + id serial + primary key, + name varchar(20) not null, + type varchar(20), + key varchar(50) not null + unique, + value text not null, + is_frontend integer not null, + remark text, + created_time timestamp with time zone not null, + updated_time timestamp with time zone +); + +comment on table sys_config is '参数配置表'; + +comment on column sys_config.id is '主键 ID'; + +comment on column sys_config.name is '名称'; + +comment on column sys_config.type is '类型'; + +comment on column sys_config.key is '键名'; + +comment on column sys_config.value is '键值'; + +comment on column sys_config.is_frontend is '是否前端'; + +comment on column sys_config.remark is '备注'; + +comment on column sys_config.created_time is '创建时间'; + +comment on column sys_config.updated_time is '更新时间'; + +alter table sys_config + owner to postgres; + +create index ix_sys_config_id + on sys_config (id); + +create table sys_notice +( + id serial + primary key, + title varchar(50) not null, + type integer not null, + author varchar(16) not null, + source varchar(50) not null, + status integer not null, + content text not null, + created_time timestamp with time zone not null, + updated_time timestamp with time zone +); + +comment on table sys_notice is '系统通知公告表'; + +comment on column sys_notice.id is '主键 ID'; + +comment on column sys_notice.title is '标题'; + +comment on column sys_notice.type is '类型(0:通知、1:公告)'; + +comment on column sys_notice.author is '作者'; + +comment on column sys_notice.source is '信息来源'; + +comment on column sys_notice.status is '状态(0:隐藏、1:显示)'; + +comment on column sys_notice.content is '内容'; + +comment on column sys_notice.created_time is '创建时间'; + +comment on column sys_notice.updated_time is '更新时间'; + +alter table sys_notice + owner to postgres; + +create index ix_sys_notice_id + on sys_notice (id); + +create table sys_dict_type +( + id serial + primary key, + name varchar(32) not null + unique, + code varchar(32) not null + unique, + status integer not null, + remark text, + created_time timestamp with time zone not null, + updated_time timestamp with time zone +); + +comment on table sys_dict_type is '字典类型表'; + +comment on column sys_dict_type.id is '主键 ID'; + +comment on column sys_dict_type.name is '字典类型名称'; + +comment on column sys_dict_type.code is '字典类型编码'; + +comment on column sys_dict_type.status is '状态(0停用 1正常)'; + +comment on column sys_dict_type.remark is '备注'; + +comment on column sys_dict_type.created_time is '创建时间'; + +comment on column sys_dict_type.updated_time is '更新时间'; + +alter table sys_dict_type + owner to postgres; + +create index ix_sys_dict_type_id + on sys_dict_type (id); + create table sys_gen_business ( id serial @@ -434,7 +533,9 @@ create table sys_gen_business updated_time timestamp with time zone ); -comment on column sys_gen_business.id is '主键id'; +comment on table sys_gen_business is '代码生成业务表'; + +comment on column sys_gen_business.id is '主键 ID'; comment on column sys_gen_business.app_name is '应用名称(英文)'; @@ -460,6 +561,9 @@ comment on column sys_gen_business.created_time is '创建时间'; comment on column sys_gen_business.updated_time is '更新时间'; +alter table sys_gen_business + owner to postgres; + create index ix_sys_gen_business_id on sys_gen_business (id); @@ -481,6 +585,9 @@ comment on column sys_role_menu.role_id is '角色ID'; comment on column sys_role_menu.menu_id is '菜单ID'; +alter table sys_role_menu + owner to postgres; + create unique index ix_sys_role_menu_id on sys_role_menu (id); @@ -502,48 +609,12 @@ comment on column sys_role_data_rule.role_id is '角色ID'; comment on column sys_role_data_rule.data_rule_id is '数据权限规则ID'; +alter table sys_role_data_rule + owner to postgres; + create unique index ix_sys_role_data_rule_id on sys_role_data_rule (id); -create table sys_dict_data -( - id serial - primary key, - label varchar(32) not null - unique, - value varchar(32) not null - unique, - sort integer not null, - status integer not null, - remark text, - type_id integer not null - references sys_dict_type - on delete cascade, - created_time timestamp with time zone not null, - updated_time timestamp with time zone -); - -comment on column sys_dict_data.id is '主键id'; - -comment on column sys_dict_data.label is '字典标签'; - -comment on column sys_dict_data.value is '字典值'; - -comment on column sys_dict_data.sort is '排序'; - -comment on column sys_dict_data.status is '状态(0停用 1正常)'; - -comment on column sys_dict_data.remark is '备注'; - -comment on column sys_dict_data.type_id is '字典类型关联ID'; - -comment on column sys_dict_data.created_time is '创建时间'; - -comment on column sys_dict_data.updated_time is '更新时间'; - -create index ix_sys_dict_data_id - on sys_dict_data (id); - create table sys_user ( id serial @@ -571,7 +642,9 @@ create table sys_user updated_time timestamp with time zone ); -comment on column sys_user.id is '主键id'; +comment on table sys_user is '用户表'; + +comment on column sys_user.id is '主键 ID'; comment on column sys_user.username is '用户名'; @@ -605,15 +678,65 @@ comment on column sys_user.created_time is '创建时间'; comment on column sys_user.updated_time is '更新时间'; +alter table sys_user + owner to postgres; + create unique index ix_sys_user_username on sys_user (username); +create index ix_sys_user_status + on sys_user (status); + create index ix_sys_user_id on sys_user (id); create unique index ix_sys_user_email on sys_user (email); +create table sys_dict_data +( + id serial + primary key, + label varchar(32) not null + unique, + value varchar(32) not null + unique, + sort integer not null, + status integer not null, + remark text, + type_id integer not null + references sys_dict_type + on delete cascade, + created_time timestamp with time zone not null, + updated_time timestamp with time zone +); + +comment on table sys_dict_data is '字典数据表'; + +comment on column sys_dict_data.id is '主键 ID'; + +comment on column sys_dict_data.label is '字典标签'; + +comment on column sys_dict_data.value is '字典值'; + +comment on column sys_dict_data.sort is '排序'; + +comment on column sys_dict_data.status is '状态(0停用 1正常)'; + +comment on column sys_dict_data.remark is '备注'; + +comment on column sys_dict_data.type_id is '字典类型关联ID'; + +comment on column sys_dict_data.created_time is '创建时间'; + +comment on column sys_dict_data.updated_time is '更新时间'; + +alter table sys_dict_data + owner to postgres; + +create index ix_sys_dict_data_id + on sys_dict_data (id); + create table sys_gen_model ( id serial @@ -632,7 +755,9 @@ create table sys_gen_model on delete cascade ); -comment on column sys_gen_model.id is '主键id'; +comment on table sys_gen_model is '代码生成模型表'; + +comment on column sys_gen_model.id is '主键 ID'; comment on column sys_gen_model.name is '列名称'; @@ -654,6 +779,9 @@ comment on column sys_gen_model.is_nullable is '是否可为空'; comment on column sys_gen_model.gen_business_id is '代码生成业务ID'; +alter table sys_gen_model + owner to postgres; + create index ix_sys_gen_model_id on sys_gen_model (id); @@ -675,6 +803,9 @@ comment on column sys_user_role.user_id is '用户ID'; comment on column sys_user_role.role_id is '角色ID'; +alter table sys_user_role + owner to postgres; + create unique index ix_sys_user_role_id on sys_user_role (id); @@ -695,7 +826,9 @@ create table sys_user_social updated_time timestamp with time zone ); -comment on column sys_user_social.id is '主键id'; +comment on table sys_user_social is '用户社交表(OAuth2)'; + +comment on column sys_user_social.id is '主键 ID'; comment on column sys_user_social.source is '第三方用户来源'; @@ -715,5 +848,8 @@ comment on column sys_user_social.created_time is '创建时间'; comment on column sys_user_social.updated_time is '更新时间'; +alter table sys_user_social + owner to postgres; + create index ix_sys_user_social_id on sys_user_social (id); diff --git a/backend/sql/postgresql/init_test_data.sql b/backend/sql/postgresql/init_test_data.sql index d00415dbe..f04acf09c 100644 --- a/backend/sql/postgresql/init_test_data.sql +++ b/backend/sql/postgresql/init_test_data.sql @@ -6,27 +6,28 @@ values (1, '创建API', 'POST', '/api/v1/apis', null, '2024-02-02 11:29:47', nu (2, '删除API', 'DELETE', '/api/v1/apis', null, '2024-02-02 11:31:32', null), (3, '编辑API', 'PUT', '/api/v1/apis/{pk}', null, '2024-02-02 11:32:22', null); -insert into sys_menu (id, title, name, sort, icon, path, menu_type, component, perms, status, display, cache, remark, parent_id, created_time, updated_time) -values (1, '测试', 'test', 0, '', null, 0, null, null, 0, 0, 1, null, null, '2023-07-27 19:14:10', null), - (2, '仪表盘', 'dashboard', 0, 'IconDashboard', 'dashboard', 0, null, null, 1, 1, 1, null, null, '2023-07-27 19:15:45', null), - (3, '工作台', 'Workplace', 0, null, 'workplace', 1, '/dashboard/workplace/index.vue', null, 1, 1, 1, null, 2, '2023-07-27 19:17:59', null), - (4, '系统管理', 'admin', 0, 'IconSettings', 'admin', 0, null, null, 1, 1, 1, null, null, '2023-07-27 19:23:00', null), - (5, '部门管理', 'SysDept', 0, null, 'sys-dept', 1, '/admin/dept/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:23:42', null), - (6, '用户管理', 'SysUser', 0, null, 'sys-user', 1, '/admin/user/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:25:13', null), - (7, '角色管理', 'SysRole', 0, null, 'sys-role', 1, '/admin/role/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:25:45', null), - (8, '菜单管理', 'SysMenu', 0, null, 'sys-menu', 1, '/admin/menu/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:45:29', null), - (9, 'API 管理', 'SysApi', 0, null, 'sys-api', 1, '/admin/api/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:24:12', null), - (10, '数据规则管理', 'SysDataRule', 0, null, 'sys-data-rule', 1, '/admin/data-rule/index.vue', null, 1, 1, 1, null, 4, '2023-07-27 19:24:12', null), - (11, '系统自动化', 'automation', 0, 'IconCodeSquare', 'automation', 0, null, null, 1, 1, 1, null, null, '2024-07-27 02:06:20', '2024-07-27 02:18:52'), - (12, '代码生成', 'CodeGenerator', 0, null, 'code-generator', 1, '/automation/generator/index.vue', null, 1, 1, 1, null, 11, '2024-07-27 12:24:54', null), - (13, '系统监控', 'monitor', 0, 'IconComputer', 'monitor', 0, null, null, 1, 1, 1, null, null, '2023-07-27 19:27:08', null), - (14, 'Redis 监控', 'Redis', 0, null, 'redis', 1, '/monitor/redis/index.vue', 'sys:monitor:redis', 1, 1, 1, null, 13, '2023-07-27 19:28:03', null), - (15, '服务器监控', 'Server', 0, null, 'server', 1, '/monitor/server/index.vue', 'sys:monitor:server', 1, 1, 1, null, 13, '2023-07-27 19:28:29', null), - (16, '日志', 'log', 0, 'IconBug', 'log', 0, null, null, 1, 1, 1, null, null, '2023-07-27 19:19:59', null), - (17, '登录日志', 'Login', 0, null, 'login', 1, '/log/login/index.vue', null, 1, 1, 1, null, 16, '2023-07-27 19:20:56', null), - (18, '操作日志', 'Opera', 0, null, 'opera', 1, '/log/opera/index.vue', null, 1, 1, 1, null, 16, '2023-07-27 19:21:28', null), - (19, '官网', 'site', 998, 'IconComputer', 'https://fastapi-practices.github.io/fastapi_best_architecture_docs/', 1, null, null, 1, 1, 1, null, null, '2023-07-27 19:22:24', null), - (20, '赞助', 'sponsor', 999, 'IconFire', 'https://wu-clan.github.io/sponsor/', 1, null, null, 1, 1, 1, null, null, '2024-07-27 12:39:57', null); +insert into fba.sys_menu (id, title, name, path, sort, icon, type, component, perms, status, display, cache, link, remark, parent_id, created_time, updated_time) +values (1, '测试', 'test', '', 0, '', 0, null, null, 0, 0, 1, null, null, null, '2023-07-27 19:14:10', null), + (2, '仪表盘', 'Dashboard', 'dashboard', 0, 'material-symbols:dashboard', 0, null, null, 1, 1, 1, null, null, null, '2023-07-27 19:15:45', null), + (3, '工作台', 'Workspace', 'workspace', 0, null, 1, '/dashboard/workspace/index.vue', null, 1, 1, 1, null, null, 2, '2023-07-27 19:17:59', null), + (4, '数据分析', 'Analytics', 'analytics', 0, null, 1, '/dashboard/analytics/index.vue', null, 1, 1, 1, null, null, 2, '2023-07-27 19:17:59', null), + (5, '系统管理', 'Admin', 'admin', 0, 'eos-icons:admin', 0, null, null, 1, 1, 1, null, null, null, '2023-07-27 19:23:00', null), + (6, '部门管理', 'SysDept', 'sys-dept', 0, null, 1, '/admin/dept/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:23:42', null), + (7, '用户管理', 'SysUser', 'sys-user', 0, null, 1, '/admin/user/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:25:13', null), + (8, '角色管理', 'SysRole', 'sys-role', 0, null, 1, '/admin/role/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:25:45', null), + (9, '菜单管理', 'SysMenu', 'sys-menu', 0, null, 1, '/admin/menu/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:45:29', null), + (10, 'API 管理', 'SysApi', 'sys-api', 0, null, 1, '/admin/api/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:24:12', null), + (11, '数据规则管理', 'SysDataRule', 'sys-data-rule', 0, null, 1, '/admin/data-rule/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:24:12', null), + (12, '系统自动化', 'Automation', 'automation', 0, 'material-symbols:automation', 0, null, null, 1, 1, 1, null, null, null, '2024-07-27 02:06:20', null), + (13, '代码生成', 'CodeGenerator', 'code-generator', 0, null, 1, '/automation/code-generator/index.vue', null, 1, 1, 1, null, null, 12, '2024-07-27 12:24:54', null), + (14, '系统监控', 'Monitor', 'monitor', 0, 'mdi:monitor-eye', 0, null, null, 1, 1, 1, null, null, null, '2023-07-27 19:27:08', null), + (15, 'Redis 监控', 'Redis', 'redis', 0, null, 1, '/monitor/redis/index.vue', null, 1, 1, 1, null, null, 14, '2023-07-27 19:28:03', null), + (16, '服务器监控', 'Server', 'server', 0, null, 1, '/monitor/server/index.vue', null, 1, 1, 1, null, null, 14, '2023-07-27 19:28:29', null), + (17, '日志', 'Log', 'log', 0, 'carbon:cloud-logging', 0, null, null, 1, 1, 1, null, null, null, '2023-07-27 19:19:59', null), + (18, '登录日志', 'Login', 'login', 0, null, 1, '/log/login/index.vue', null, 1, 1, 1, null, null, 17, '2023-07-27 19:20:56', null), + (19, '操作日志', 'Opera', 'opera', 0, null, 1, '/log/opera/index.vue', null, 1, 1, 1, null, null, 17, '2023-07-27 19:21:28', null), + (20, '官网', 'Site', '', 998, 'dashicons:admin-site', 1, null, null, 1, 1, 1, 'https://fastapi-practices.github.io/fastapi_best_architecture_docs/', null, null, '2023-07-27 19:22:24', null), + (21, '赞助', 'Sponsor', '', 999, 'material-icon-theme:github-sponsors', 1, null, null, 1, 1, 1, 'https://wu-clan.github.io/sponsor/', null, null, '2024-07-27 12:39:57', null); insert into sys_role (id, name, status, remark, created_time, updated_time) values (1, 'test', 1, null, '2023-06-26 17:13:45', null); diff --git a/backend/utils/build_tree.py b/backend/utils/build_tree.py index c227a37c2..2ff8a759d 100644 --- a/backend/utils/build_tree.py +++ b/backend/utils/build_tree.py @@ -84,3 +84,30 @@ def get_tree_data( case _: raise ValueError(f'无效的算法类型:{build_type}') return tree + + +def get_vben5_tree_data(row: Sequence[RowData]) -> list[dict[str, Any]]: + """ + 获取 vben5 菜单树形结构数据 + + :param row: 原始数据行序列 + :return: + """ + # 需要移除的原始字段 + remove_keys = {'status', 'display', 'title', 'link', 'cache'} + + vben5_nodes = [ + { + **{k: v for k, v in node.items() if k not in remove_keys}, + 'disabled': node['status'], + 'show': node['display'], + 'meta': { + 'title': node['title'], + 'link': node['link'], + 'keepAlive': node['cache'], + }, + } + for node in get_tree_nodes(row) + ] + + return traversal_to_tree(vben5_nodes)