mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 04:46:26 +00:00
feat: 新增刷新缓存功能并优化系统初始化
refactor: 重构模型加载选项和CRUD预加载逻辑 fix: 修复日期范围查询格式问题 style: 优化前端组件样式和布局 perf: 提升字典数据更新性能 docs: 更新注释和文档说明 chore: 清理无用文件和代码 test: 更新测试用例 build: 添加vue-json-pretty依赖 ci: 优化初始化脚本和事务处理
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Dict, List, Optional, Sequence
|
||||
from typing import Dict, List, Optional, Sequence, Union, Any
|
||||
|
||||
from app.core.base_crud import CRUDBase
|
||||
from ..auth.schema import AuthSchema
|
||||
@@ -21,42 +21,45 @@ class ParamsCRUD(CRUDBase[ParamsModel, ParamsCreateSchema, ParamsUpdateSchema]):
|
||||
self.auth = auth
|
||||
super().__init__(model=ParamsModel, auth=auth)
|
||||
|
||||
async def get_obj_by_id_crud(self, id: int) -> Optional[ParamsModel]:
|
||||
async def get_obj_by_id_crud(self, id: int, preload: Optional[List[Union[str, Any]]] = None) -> Optional[ParamsModel]:
|
||||
"""
|
||||
获取配置管理型详情
|
||||
|
||||
参数:
|
||||
- id (int): 配置管理型ID
|
||||
- preload (Optional[List[Union[str, Any]]]): 预加载关系,未提供时使用模型默认项
|
||||
|
||||
返回:
|
||||
- Optional[ParamsModel]: 配置管理型模型实例
|
||||
"""
|
||||
return await self.get(id=id)
|
||||
return await self.get(id=id, preload=preload)
|
||||
|
||||
async def get_obj_by_key_crud(self, key: str) -> Optional[ParamsModel]:
|
||||
async def get_obj_by_key_crud(self, key: str, preload: Optional[List[Union[str, Any]]] = None) -> Optional[ParamsModel]:
|
||||
"""
|
||||
根据key获取配置管理型详情
|
||||
|
||||
参数:
|
||||
- key (str): 配置管理型key
|
||||
- preload (Optional[List[Union[str, Any]]]): 预加载关系,未提供时使用模型默认项
|
||||
|
||||
返回:
|
||||
- Optional[ParamsModel]: 配置管理型模型实例
|
||||
"""
|
||||
return await self.get(config_key=key)
|
||||
return await self.get(config_key=key, preload=preload)
|
||||
|
||||
async def get_obj_list_crud(self, search: Optional[Dict] = None, order_by: Optional[List[Dict[str, str]]] = None) -> Sequence[ParamsModel]:
|
||||
async def get_obj_list_crud(self, search: Optional[Dict] = None, order_by: Optional[List[Dict[str, str]]] = None, preload: Optional[List[Union[str, Any]]] = None) -> Sequence[ParamsModel]:
|
||||
"""
|
||||
获取配置管理型列表
|
||||
|
||||
参数:
|
||||
- search (Dict | None): 查询参数对象。
|
||||
- order_by (List[Dict[str, str]] | None): 排序参数列表。
|
||||
- preload (Optional[List[Union[str, Any]]]): 预加载关系,未提供时使用模型默认项
|
||||
|
||||
返回:
|
||||
- Sequence[ParamsModel]: 配置管理型模型实例列表
|
||||
"""
|
||||
return await self.list(search=search, order_by=order_by)
|
||||
return await self.list(search=search, order_by=order_by, preload=preload)
|
||||
|
||||
async def create_obj_crud(self, data: ParamsCreateSchema) -> Optional[ParamsModel]:
|
||||
"""
|
||||
@@ -93,4 +96,4 @@ class ParamsCRUD(CRUDBase[ParamsModel, ParamsCreateSchema, ParamsUpdateSchema]):
|
||||
返回:
|
||||
- None
|
||||
"""
|
||||
return await self.delete(ids=ids)
|
||||
return await self.delete(ids=ids)
|
||||
@@ -13,6 +13,7 @@ class ParamsModel(CreatorMixin):
|
||||
"""
|
||||
__tablename__ = "system_param"
|
||||
__table_args__ = ({'comment': '系统参数表'})
|
||||
__loader_options__ = ["creator"]
|
||||
|
||||
# 基础字段
|
||||
config_name: Mapped[str] = mapped_column(String(500), nullable=False, unique=True, comment='参数名称')
|
||||
|
||||
Reference in New Issue
Block a user