mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-09 11:12:02 +00:00
style: 移除Python文件中的编码声明并优化代码格式
refactor: 重构前端组件和样式,添加AI助手功能 docs: 更新README文档,添加ruff代码检查说明 feat: 新增AI助手相关API和前端组件 chore: 更新.gitignore文件,添加ruff缓存配置 fix: 修复前端布局和设置相关的问题 perf: 优化代码结构和性能,移除冗余代码 test: 更新测试文件,移除编码声明 build: 更新依赖版本,调整requirements.txt
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from sqlalchemy import Boolean, String, Integer, JSON, ForeignKey
|
||||
from sqlalchemy.orm import relationship, Mapped, mapped_column
|
||||
|
||||
from sqlalchemy import JSON, Boolean, ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.core.base_model import ModelMixin
|
||||
|
||||
@@ -13,10 +12,10 @@ if TYPE_CHECKING:
|
||||
class MenuModel(ModelMixin):
|
||||
"""
|
||||
菜单表 - 用于存储系统菜单信息
|
||||
|
||||
|
||||
菜单类型说明:
|
||||
- 1: 目录(一级菜单)
|
||||
- 2: 菜单(二级菜单)
|
||||
- 2: 菜单(二级菜单)
|
||||
- 3: 按钮/权限(页面内按钮权限)
|
||||
- 4: 外部链接
|
||||
"""
|
||||
@@ -39,30 +38,30 @@ class MenuModel(ModelMixin):
|
||||
title: Mapped[str | None] = mapped_column(String(50), comment='菜单标题')
|
||||
params: Mapped[list[dict[str, str]] | None] = mapped_column(JSON, comment='路由参数(JSON对象)')
|
||||
affix: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False, comment='是否固定标签页(True:是 False:否)')
|
||||
|
||||
|
||||
# 树形结构
|
||||
parent_id: Mapped[int | None] = mapped_column(
|
||||
Integer,
|
||||
ForeignKey('sys_menu.id', ondelete='SET NULL'),
|
||||
default=None,
|
||||
index=True,
|
||||
Integer,
|
||||
ForeignKey('sys_menu.id', ondelete='SET NULL'),
|
||||
default=None,
|
||||
index=True,
|
||||
comment='父菜单ID'
|
||||
)
|
||||
|
||||
|
||||
# 关联关系
|
||||
parent: Mapped["MenuModel | None"] = relationship(
|
||||
back_populates='children',
|
||||
remote_side="MenuModel.id",
|
||||
back_populates='children',
|
||||
remote_side="MenuModel.id",
|
||||
foreign_keys="MenuModel.parent_id",
|
||||
uselist=False
|
||||
)
|
||||
children: Mapped[list["MenuModel"] | None] = relationship(
|
||||
back_populates='parent',
|
||||
back_populates='parent',
|
||||
foreign_keys="MenuModel.parent_id",
|
||||
order_by="MenuModel.order"
|
||||
)
|
||||
roles: Mapped[list["RoleModel"]] = relationship(
|
||||
secondary="sys_role_menus",
|
||||
back_populates="menus",
|
||||
secondary="sys_role_menus",
|
||||
back_populates="menus",
|
||||
lazy="selectin"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user