refactor(myapp): 重命名查询参数类以统一命名风格

- 将 ApplicationQueryParams 改为 ApplicationQueryParam
- 同步更新相关导入和函数参数类型注解
- 修改 PaginationQueryParams 为 PaginationQueryParam

refactor(demo): 重命名查询参数类以统一命名风格

- 将 DemoQueryParams 改为 DemoQueryParam
- 同步更新相关导入和函数参数类型注解
- 修改 PaginationQueryParams 为 PaginationQueryParam

refactor(gencode): 优化代码生成模块的模型和服务层结构

- 统一模型名称后缀为 Schema,调整相关引用
- 规范 Pydantic schema 的命名和定义
- 删除无用的 Python DAO 模板文件
- 调整导入路径,统一使用 app 目录下的模块路径
- 改进服务层方法签名,添加返回类型注解
- 使用自定义异常 CustomException 替代旧异常
- 统一成功响应格式为 SuccessResponse
- 优化代码生成服务中的数据库操作 DAO 调用参数传递
- 优化代码生成业务表和字段模型的字段定义,添加注释和默认值
- 优化生成代码路径处理逻辑和异常信息提示
- 整合分页查询参数定义,统一分页模型
- 修正多个服务方法的参数类型和返回类型
- 删除无用的导入和多余注释,提升代码整洁度
This commit is contained in:
zhangtao
2025-09-18 01:51:41 +08:00
parent 035efcd796
commit 019bfdf57b
69 changed files with 663 additions and 531 deletions
+1
View File
@@ -67,6 +67,7 @@ class GenConstants:
# 页面不需要查询字段
COLUMN_NAME_NOT_QUERY = ["id", "create_by", "dept_id", "create_time", "del_flag", "update_by", "update_time", "remark"]
# Dao基类字段
DAO_COLUMN_NOT_EDIT = ["create_by", "dept_id", "create_time", "del_flag", "update_time"]
# Entity基类字段
+2 -2
View File
@@ -50,9 +50,9 @@ class RedisInitKeyConfig(Enum):
@property
def key(self) -> str:
"""获取Redis键名"""
return self.value.get('key')
return self.value.get('key', '')
@property
def remark(self) -> str:
"""获取Redis键名说明"""
return self.value.get('remark')
return self.value.get('remark', '')
+4 -4
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from typing import Any, Mapping, Optional, Dict, Union
from typing import Any, Mapping, Optional
from fastapi import status
from fastapi.responses import JSONResponse, StreamingResponse, FileResponse
from starlette.background import BackgroundTask
@@ -22,7 +22,7 @@ class SuccessResponse(JSONResponse):
def __init__(
self,
data: Optional[Any] = None,
msg: Optional[str] = RET.OK.msg,
msg: str = RET.OK.msg,
code: int = RET.OK.code,
status_code: int = status.HTTP_200_OK,
success: bool = True
@@ -51,7 +51,7 @@ class ErrorResponse(JSONResponse):
def __init__(
self,
data: Optional[Any] = None,
msg: Optional[str] = RET.ERROR.msg,
msg: str = RET.ERROR.msg,
code: int = RET.ERROR.code,
status_code: int = status.HTTP_400_BAD_REQUEST,
success: bool = False
@@ -111,7 +111,7 @@ class UploadFileResponse(FileResponse):
file_path: str,
filename: str,
media_type: str = "application/octet-stream",
headers: Optional[Dict[str, Union[str, int]]] = None,
headers: Optional[Mapping[str, str]] = None,
background: Optional[BackgroundTask] = None,
status_code: int = 200
):