Files
FastapiAdmin/backend/app/api/v1/models/demo/example_model.py
T
zhangtao 18bcd1961c feat: 添加演示模块并优化日期选择器组件
refactor: 重构文件导入组件为通用组件

fix: 修复导出文件名统一问题

docs: 更新README添加二次开发教程

style: 统一系统管理页面的日期选择器实现

chore: 更新数据库迁移脚本和初始化数据

perf: 优化前端页面日期范围选择交互

test: 添加演示模块相关测试文件

build: 更新依赖项配置

ci: 调整CI/CD脚本配置
2025-08-03 17:33:24 +08:00

42 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, Float, ForeignKey, Integer, String, Text
from sqlalchemy.orm import relationship
from app.core.base_model import ModelBase
class ExampleModel(ModelBase):
"""
示例表
"""
__tablename__ = 'demo_example'
__table_args__ = ({'comment': '示例表'})
id=Column(Integer, primary_key=True, autoincrement=True, comment='ID')
name=Column(String(64), nullable=True, default='', comment='名称')
description=Column(Text, nullable=True, comment='描述')
status = Column(Boolean, default=False, nullable=True, comment='任务状态:正常,停止')
# 审计字段
description = Column(Text, nullable=True, comment="备注说明")
created_at = Column(DateTime, nullable=True, default=datetime.now, comment='创建时间')
updated_at = Column(DateTime, nullable=True, default=datetime.now, onupdate=datetime.now, comment='更新时间')
creator_id = Column(
Integer,
ForeignKey("system_users.id", ondelete="SET NULL", onupdate="CASCADE"),
nullable=True,
index=True,
comment="创建人ID"
)
creator = relationship(
"UserModel",
foreign_keys=creator_id,
lazy="joined",
post_update=True,
uselist=False
)