179 lines
5.3 KiB
Python
179 lines
5.3 KiB
Python
# _*_ coding : UTF-8 _*_
|
|
# @Time : 2025/02/13 22:07
|
|
# @UpdateTime : 2025/02/13 22:07
|
|
# @Author : sonder
|
|
# @File : code.py
|
|
# @Software : PyCharm
|
|
# @Comment : 本程序
|
|
from datetime import datetime
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
from pydantic.alias_generators import to_camel
|
|
|
|
from schemas.common import BaseResponse, ListQueryResult
|
|
|
|
|
|
class CodeInfo(BaseModel):
|
|
"""
|
|
编码信息模型
|
|
"""
|
|
model_config = ConfigDict(
|
|
alias_generator=to_camel
|
|
)
|
|
id: str = Field(..., description="主键")
|
|
create_by: str = Field(default="", description="创建者")
|
|
create_time: Optional[datetime] = Field(default=None, description="创建时间")
|
|
update_by: str = Field(default="", description="更新者")
|
|
update_time: Optional[datetime] = Field(default=None, description="更新时间")
|
|
code: str = Field(..., description="编码")
|
|
description: str = Field(..., description="描述")
|
|
|
|
|
|
class AddCodeParams(BaseModel):
|
|
"""
|
|
更新编码参数
|
|
"""
|
|
code: str = Field(..., description="编码")
|
|
description: str = Field(..., description="描述")
|
|
|
|
model_config = ConfigDict(
|
|
alias_generator=to_camel
|
|
)
|
|
|
|
|
|
class GetCodeInfoResponse(BaseResponse):
|
|
"""
|
|
获取编码信息响应
|
|
"""
|
|
data: CodeInfo = Field(..., description="编码信息")
|
|
|
|
|
|
class GetCodeListResult(ListQueryResult):
|
|
"""
|
|
获取编码列表结果
|
|
"""
|
|
result: List[CodeInfo] = Field(..., description="编码列表")
|
|
|
|
|
|
class GetCodeListResponse(BaseResponse):
|
|
"""
|
|
获取编码列表响应
|
|
"""
|
|
data: GetCodeListResult = Field(..., description="编码列表")
|
|
|
|
|
|
class GetQueryCodeParams(BaseModel):
|
|
"""
|
|
获取查询编码结果
|
|
"""
|
|
query_text: str = Field(..., description="查询文本")
|
|
|
|
|
|
class QueryResultItem(BaseModel):
|
|
"""
|
|
查询结果项
|
|
"""
|
|
model_config = ConfigDict(
|
|
alias_generator=to_camel
|
|
)
|
|
id: str = Field(..., description="主键")
|
|
code: str = Field(..., description="编码")
|
|
description: str = Field(..., description="描述")
|
|
match_rate: float = Field(..., description="匹配度")
|
|
|
|
|
|
class QueryResult(BaseModel):
|
|
"""
|
|
查询结果
|
|
"""
|
|
model_config = ConfigDict(
|
|
alias_generator=to_camel
|
|
)
|
|
id: str = Field(..., description="主键")
|
|
query_text: str = Field(..., description="查询文本")
|
|
status: int = Field(..., description="查询状态")
|
|
result: List[QueryResultItem] = Field(..., description="查询结果")
|
|
|
|
|
|
class QueryCodeResult(BaseModel):
|
|
"""
|
|
查询编码结果
|
|
"""
|
|
model_config = ConfigDict(
|
|
alias_generator=to_camel
|
|
)
|
|
id: str = Field(..., description="查询ID")
|
|
query: str = Field(..., description="查询文本")
|
|
query_count: int = Field(..., description="查询统计")
|
|
cost_time: float = Field(..., description="消耗时间(毫秒)")
|
|
result_count: int = Field(..., description="结果统计")
|
|
response_result: List[QueryResult] = Field(..., description="查询结果")
|
|
status: int = Field(..., description="查询状态")
|
|
operator_time: str = Field(default="", description="操作时间")
|
|
|
|
|
|
class QueryCodeResponse(BaseResponse):
|
|
"""
|
|
查询编码响应
|
|
"""
|
|
data: QueryCodeResult = Field(..., description="查询编码结果")
|
|
|
|
|
|
class QueryCodeLogInfo(BaseModel):
|
|
"""
|
|
查询编码日志信息
|
|
"""
|
|
model_config = ConfigDict(
|
|
alias_generator=to_camel
|
|
)
|
|
id: str = Field(default="", description="主键")
|
|
query_count: int = Field(default=0, description="查询统计")
|
|
result_count: int = Field(default=0, description="结果统计")
|
|
cost_time: float = Field(default=0.0, description="消耗时间(毫秒)")
|
|
operator_time: str = Field(default="", description="操作时间")
|
|
request_params: str = Field(default="", description="请求参数")
|
|
response_result: str = Field(default="", description="响应结果")
|
|
status: int = Field(default=0, description="查询状态")
|
|
operator_id: str = Field(default="", description="操作人员ID")
|
|
operator_name: str = Field(default="", description="操作人员名称")
|
|
operator_nickname: str = Field(default="", description="操作人员昵称")
|
|
department_id: str = Field(default="", description="操作人员部门ID")
|
|
department_name: str = Field(default="", description="操作人员部门名称")
|
|
|
|
|
|
class QueryCodeLogResult(ListQueryResult):
|
|
"""
|
|
查询编码日志结果
|
|
"""
|
|
result: List[QueryCodeLogInfo] = Field(..., description="查询编码日志列表")
|
|
|
|
|
|
class GetQueryCodeLogResponse(BaseResponse):
|
|
"""
|
|
查询编码日志响应
|
|
"""
|
|
data: QueryCodeLogResult = Field(..., description="查询编码日志结果")
|
|
|
|
|
|
class GetQueryCodeLogDetailResponse(BaseResponse):
|
|
"""
|
|
查询编码日志详情响应
|
|
"""
|
|
data: QueryCodeLogInfo = Field(..., description="查询编码日志详情")
|
|
|
|
|
|
class GetCodeLogAllResult(BaseModel):
|
|
"""
|
|
查询所有编码日志结果
|
|
"""
|
|
result: List[QueryCodeLogInfo] = Field(..., description="查询编码日志列表")
|
|
total: int = Field(..., description="总条数")
|
|
|
|
|
|
class GetCodeLogAllResponse(BaseResponse):
|
|
"""
|
|
查询所有编码日志响应
|
|
"""
|
|
data: GetCodeLogAllResult = Field(..., description="查询编码日志结果")
|