You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
33 lines
1.2 KiB
"""
|
|
{{ table.comment }} Pydantic Schemas - 对齐JAVA Entity
|
|
|
|
@author: {{ author }}
|
|
@date: {{ date }}
|
|
"""
|
|
from pydantic import BaseModel, Field
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
|
|
class {{ table.entity }}(BaseModel):
|
|
"""
|
|
{{ table.comment }} - 对齐JAVA Entity
|
|
所有接口共用同一个Schema作为入参
|
|
"""
|
|
id: Optional[int] = Field(None, description="主键ID")
|
|
{% for field in fields %}
|
|
{{ field.name }}: Optional[{{ field.python_type }}] = Field(None, description="{{ field.comment }}")
|
|
{% endfor %}
|
|
# 分页字段 - 对齐JAVA BaseEntity
|
|
pageNum: Optional[int] = Field(None, description="当前页码")
|
|
pageSize: Optional[int] = Field(None, description="每页数量")
|
|
# 审计字段
|
|
created_at: Optional[datetime] = Field(None, description="创建时间")
|
|
updated_at: Optional[datetime] = Field(None, description="更新时间")
|
|
created_by: Optional[str] = Field(None, description="创建人")
|
|
updated_by: Optional[str] = Field(None, description="更新人")
|
|
is_deleted: Optional[bool] = Field(False, description="是否删除")
|
|
# 用户信息
|
|
user_id: Optional[str] = Field(None, description="用户ID")
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|