mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 04:46:26 +00:00
本次提交包含多项优化和修复: 1. 修复CRUD初始化参数传递、搜索参数处理逻辑 2. 更新环境配置中的大模型相关参数 3. 重构部分服务方法命名,统一代码风格 4. 新增多个枚举类型,补充模型关联关系和加载选项 5. 优化查询参数类实现,完善字段校验逻辑 6. 调整Pydantic模型字段注释和类型定义 7. 简化并移除冗余的CRUD方法实现 8. 新增超级管理员权限装饰器 9. 修复邮件日志模型的租户关联和字段定义
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
from typing import TYPE_CHECKING
|
|
|
|
from sqlalchemy import Integer, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.core.base_model import ModelMixin, TenantMixin, UserMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from app.api.v1.module_system.user.model import UserModel
|
|
|
|
|
|
class PositionModel(ModelMixin, TenantMixin, UserMixin):
|
|
"""
|
|
岗位模型
|
|
"""
|
|
|
|
__tablename__: str = "sys_position"
|
|
__table_args__: dict[str, str] = {"comment": "岗位表"}
|
|
__loader_options__: list[str] = [
|
|
"users",
|
|
"created_by",
|
|
"updated_by",
|
|
"deleted_by",
|
|
"tenant_by",
|
|
]
|
|
|
|
name: Mapped[str] = mapped_column(String(64), nullable=False, comment="岗位名称")
|
|
code: Mapped[str] = mapped_column(String(64), nullable=False, comment="岗位编码")
|
|
order: Mapped[int] = mapped_column(Integer, nullable=False, default=1, comment="显示排序")
|
|
status: Mapped[int] = mapped_column(Integer, default=0, nullable=False, comment="状态(0:启动 1:停用)", index=True)
|
|
description: Mapped[str | None] = mapped_column(Text, default=None, nullable=True, comment="备注")
|
|
|
|
# 关联关系
|
|
users: Mapped[list["UserModel"]] = relationship(
|
|
secondary="sys_user_positions",
|
|
back_populates="positions",
|
|
lazy="selectin",
|
|
)
|