mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-23 05:30:54 +00:00
* Refactor foreign keys and relationships to pure logic * Revert of some changes * More revert * Update the user paginate * Update user create and update * Update dept select and delete * Rename the join query functions * Update select_join_serialize doc and README * Fix typo in README * Update the user delete * Update the user social * Update the dict plugin crud * Update the dict plugin version * Bump dependencies and pre-commits * Update the code generator plugin crud * Update the menu crud * Update the role crud * Update the data scope and rule crud * Restore get_paginated to get_select * Update the code generator plugin version * Add the py version in pre-commit * Remove the plugin include parameter config * Add more cache cleaning TODO * Rename get_with_relation to get_join * Add the user cache clear * Fix known compatibility issues * Update the version number to 1.11.0 * Fix lint * Optimize select_join_serialize logic * Delete cache cleanup comments * Update the oauth2 plugin version * Fix user-role table cleanup when user update
30 lines
1.6 KiB
Python
30 lines
1.6 KiB
Python
import sqlalchemy as sa
|
|
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from backend.common.model import Base, UniversalText, id_key
|
|
|
|
|
|
class Menu(Base):
|
|
"""菜单表"""
|
|
|
|
__tablename__ = 'sys_menu'
|
|
|
|
id: Mapped[id_key] = mapped_column(init=False)
|
|
title: Mapped[str] = mapped_column(sa.String(64), comment='菜单标题')
|
|
name: Mapped[str] = mapped_column(sa.String(64), comment='菜单名称')
|
|
path: Mapped[str | None] = mapped_column(sa.String(200), comment='路由地址')
|
|
sort: Mapped[int] = mapped_column(default=0, comment='排序')
|
|
icon: Mapped[str | None] = mapped_column(sa.String(128), default=None, comment='菜单图标')
|
|
type: Mapped[int] = mapped_column(default=0, comment='菜单类型(0目录 1菜单 2按钮 3内嵌 4外链)')
|
|
component: Mapped[str | None] = mapped_column(sa.String(256), default=None, comment='组件路径')
|
|
perms: Mapped[str | None] = mapped_column(sa.String(128), 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(UniversalText, default=None, comment='外链地址')
|
|
remark: Mapped[str | None] = mapped_column(UniversalText, default=None, comment='备注')
|
|
|
|
# 父级菜单
|
|
parent_id: Mapped[int | None] = mapped_column(sa.BigInteger, default=None, index=True, comment='父菜单ID')
|