sys_post_dto.py 882 B

1234567891011121314151617181920212223242526272829
  1. from typing import Optional
  2. from pydantic import Field
  3. from domain.dtos.base_dto import DtoBase
  4. class SysPostBaseDto(DtoBase):
  5. post_name: str = Field(..., title="岗位名称", max_length=30)
  6. post_code: str = Field(..., title="岗位编码", max_length=60)
  7. status: int = Field(0, title="状态", ge=0, le=1)
  8. remark: Optional[str] = Field(None, title="备注", max_length=500)
  9. class Config:
  10. from_attributes = True
  11. class SysPostDto(SysPostBaseDto):
  12. id: int = Field(..., title="岗位ID", gt=0)
  13. class SysPostCreateDto(SysPostBaseDto):
  14. post_name: str = Field(..., title="岗位名称", max_length=30)
  15. post_code: str = Field(..., title="岗位编码", max_length=60)
  16. class SysPostUpdateDto(SysPostBaseDto):
  17. id: int = Field(..., title="岗位ID", gt=0)
  18. post_code: Optional[str] = Field(None, title="岗位编码", max_length=60)