Files
FastapiAdmin/backend/app/api/v1/module_example/demo/model.py
T
zhangtao c0d32a7eec refactor: 统一将creator_id重命名为created_id并优化模型关系
feat: 新增系统租户和用户初始化数据

style: 优化代码注释和格式

fix: 修复数据权限检查逻辑中的created_id字段判断

perf: 移除不必要的模型关系以提升性能

docs: 更新初始化数据的描述信息

chore: 清理废弃文件和冗余代码
2025-11-24 01:02:27 +08:00

24 lines
785 B
Python

# -*- coding: utf-8 -*-
from sqlalchemy import String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base_model import ModelMixin, UserMixin, TenantMixin, CustomerMixin
class DemoModel(ModelMixin, UserMixin, TenantMixin, CustomerMixin):
"""
示例表
数据隔离策略:
- 租户级示例: tenant_id必填, customer_id=NULL
- 客户级示例: tenant_id必填, customer_id>0
根据业务需求,此示例表支持客户级数据隔离
"""
__tablename__: str = 'gen_demo'
__table_args__: dict[str, str] = ({'comment': '示例表'})
__loader_options__: list[str] = ["created_by", "updated_by", "tenant", "customer"]
name: Mapped[str | None] = mapped_column(String(64), nullable=True, default='', comment='名称')