chore: 批量优化项目代码,修复多处细节问题

本次提交包含多项优化和修复:
1. 修复CRUD初始化参数传递、搜索参数处理逻辑
2. 更新环境配置中的大模型相关参数
3. 重构部分服务方法命名,统一代码风格
4. 新增多个枚举类型,补充模型关联关系和加载选项
5. 优化查询参数类实现,完善字段校验逻辑
6. 调整Pydantic模型字段注释和类型定义
7. 简化并移除冗余的CRUD方法实现
8. 新增超级管理员权限装饰器
9. 修复邮件日志模型的租户关联和字段定义
This commit is contained in:
zhangtao
2026-06-20 23:37:58 +08:00
parent bbe77930a8
commit 4e2b668d7b
96 changed files with 2914 additions and 1936 deletions
@@ -5,7 +5,8 @@ from fastapi import Query
from pydantic import BaseModel, ConfigDict, Field, field_validator
from app.common.enums import QueueEnum
from app.core.base_schema import BaseSchema
from app.core.base_params import BaseQueryParam, TenantByQueryParam, UserByQueryParam
from app.core.base_schema import BaseSchema, TenantBySchema, UserBySchema
class GenDBTableSchema(BaseModel):
@@ -254,7 +255,7 @@ class GenTableSchema(BaseModel):
return s if s else None
class GenTableOutSchema(GenTableSchema, BaseSchema):
class GenTableOutSchema(GenTableSchema, BaseSchema, UserBySchema, TenantBySchema):
"""业务表输出模型(面向控制器/前端)。"""
model_config = ConfigDict(from_attributes=True)
@@ -300,7 +301,7 @@ class GenSyncPreviewSchema(BaseModel):
@dataclass
class GenTableQueryParam:
class GenTableQueryParam(BaseQueryParam, UserByQueryParam, TenantByQueryParam):
"""代码生成业务表查询参数
- 支持按`table_name`、`table_comment`进行模糊检索(由CRUD层实现like)。
- 空值将被忽略,不参与过滤。
@@ -310,20 +311,10 @@ class GenTableQueryParam:
self,
table_name: str | None = Query(None, description="表名称"),
table_comment: str | None = Query(None, description="表注释"),
*args,
**kwargs,
) -> None:
super().__init__(*args, **kwargs)
# 模糊查询字段
self.table_name = (QueueEnum.like.value, table_name)
self.table_comment = (QueueEnum.like.value, table_comment)
class GenTableColumnQueryParam:
"""代码生成业务表字段查询参数
- `column_name`按like规则模糊查询(透传到CRUD层)
"""
def __init__(
self,
column_name: str | None = Query(None, description="列名称"),
) -> None:
# 模糊查询字段:约定("like", 值)格式,便于CRUD解析
self.column_name = (QueueEnum.like.value, column_name)
self.table_name = (QueueEnum.like.value, table_name) if table_name else None
self.table_comment = (QueueEnum.like.value, table_comment) if table_comment else None