mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-24 05:26:58 +00:00
本次提交主要包含以下变更: 1. 新增任务管理模块,支持定时任务的创建、更新、删除和状态管理 2. 新增字典管理模块,用于维护系统中常用的固定数据 3. 优化系统配置,移除Celery,改用APScheduler进行任务调度 4. 修复部分前端组件的样式问题,统一输入框宽度 5. 更新文档和相关图片资源,完善系统功能描述 这些变更旨在增强系统的可维护性和功能性,提供更灵活的任务调度机制和更便捷的字典数据管理方式。
79 lines
3.0 KiB
Python
79 lines
3.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from datetime import datetime
|
|
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String, Text
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.core.base_model import ModelBase
|
|
|
|
|
|
class DictTypeModel(ModelBase):
|
|
"""
|
|
字典类型表
|
|
"""
|
|
|
|
__tablename__ = "system_dict_type"
|
|
__table_args__ = ({'comment': '数据字典类型表'})
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True, comment='字典主键')
|
|
dict_name = Column(String(100), nullable=True, default='', comment='字典名称')
|
|
dict_type = Column(String(100), nullable=True, default='', comment='字典类型')
|
|
available = Column(Boolean, nullable=True, default='0', comment='状态(0正常 1停用)')
|
|
|
|
# 审计字段
|
|
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
|
|
)
|
|
|
|
|
|
class DictDataModel(ModelBase):
|
|
"""
|
|
字典数据表
|
|
"""
|
|
|
|
__tablename__ = 'system_dict_data'
|
|
__table_args__ = ({'comment': '数据字典数据表'})
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True, comment='字典编码')
|
|
dict_sort = Column(Integer, nullable=True, default=0, comment='字典排序')
|
|
dict_label = Column(String(100), nullable=True, default='', comment='字典标签')
|
|
dict_value = Column(String(100), nullable=True, default='', comment='字典键值')
|
|
dict_type = Column(String(100), nullable=True, default='', comment='字典类型')
|
|
css_class = Column(String(100), nullable=True, default=None, comment='样式属性(其他样式扩展)')
|
|
list_class = Column(String(100), nullable=True, default=None, comment='表格回显样式')
|
|
is_default = Column(Boolean, nullable=True, default='N', comment='是否默认(Y是 N否)')
|
|
available = Column(Boolean, nullable=True, default='0', comment='状态(0正常 1停用)')
|
|
|
|
# 审计字段
|
|
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
|
|
)
|