Files
FastapiAdmin/backend/app/api/v1/models/system/config_model.py
T
zhangtao 9d426b2e4c feat: 新增配置中心功能并优化系统配置管理
refactor: 重构配置管理相关代码,包括模型、参数和CRUD操作
docs: 更新README文档中的图片引用
style: 统一前端表格样式和布局,优化暗色模式背景色
fix: 修复日志记录中用户信息泄露问题
perf: 优化前端路由和组件性能
chore: 更新依赖和脚本文件
```

这个提交消息涵盖了以下主要变更:
1. 新增了配置中心功能模块
2. 重构了后端配置管理相关代码
3. 更新了文档中的图片引用
4. 统一了前端表格样式
5. 修复了安全相关问题
6. 优化了前端性能
7. 更新了项目依赖

消息遵循了约定的提交格式,每个类型都准确地描述了变更的性质,并保持了简洁性。
2025-06-02 22:35:45 +08:00

42 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
from datetime import datetime
from sqlalchemy import Column, String, Integer, DateTime, ForeignKey, Text, Boolean
from sqlalchemy.orm import relationship
from app.core.base_model import ModelBase
class ConfigModel(ModelBase):
"""
配置表 - 用于存储组织架构中的配置信息
"""
__tablename__ = "system_config"
__table_args__ = ({'comment': '配置表'})
# 基础字段
id = Column(Integer, primary_key=True, autoincrement=True, comment='主键ID')
config_name = Column(String(500), nullable=True, unique=True, default='', comment='参数名称')
config_key = Column(String(500), nullable=True, unique=True, default='', comment='参数键名')
config_value = Column(String(500), nullable=True, default='', comment='参数键值')
config_type = Column(Boolean, default=False, nullable=False, comment="系统内置((True:是 False:否))")
# 审计字段
description = Column(Text, nullable=True, comment="备注说明")
created_at = Column(DateTime, default=datetime.now, comment='创建时间')
updated_at = Column(DateTime, 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
)