from datetime import datetime from typing import Optional from pydantic import Field from domain.dtos.base_dto import DtoBase class SysOperLogDto(DtoBase): id: Optional[int] = Field(..., title="日志ID", gt=0) title: str = Field(..., title="操作模块", max_length=50) business_type: int = Field(0, title="业务类型", ge=0, le=5) method: str = Field(..., title="方法名称", max_length=100) request_method: str = Field(..., title="请求方式", max_length=10) operator_type: int = Field(0, title="操作类别", ge=0, le=2) dept_name: str = Field(..., title="部门名称", max_length=50) oper_name: str = Field(..., title="操作人员", max_length=30) oper_url: str = Field(..., title="请求URL", max_length=255) oper_ip: str = Field(..., title="主机地址", max_length=50) oper_location: str = Field(..., title="操作地点", max_length=255) oper_param: str = Field(..., title="请求参数", max_length=2000) json_result: str = Field(..., title="返回参数", max_length=2000) status: int = Field(0, title="操作状态", ge=0, le=1) error_msg: Optional[str] = Field(None, title="错误信息", max_length=2000) oper_time: datetime = Field(..., title="操作时间") cost_time: int = Field(0, title="请求耗时", ge=0) class Config: from_attributes = True class SysLoginLogDto(DtoBase): id: Optional[int] = Field(..., title="日志ID", gt=0) username: str = Field(..., title="用户账号", max_length=30) ipaddr: str = Field(..., title="登录IP地址", max_length=50) login_location: str = Field(..., title="登录地点", max_length=255) browser: str = Field(..., title="浏览器类型", max_length=50) os: str = Field(..., title="操作系统", max_length=50) status: int = Field(0, title="登录状态", ge=0, le=1) msg: str = Field(..., title="提示消息", max_length=255) login_time: datetime = Field(..., title="登录时间")