lot_manager/db/models/base.py

26 lines
768 B
Python
Raw Normal View History

2023-12-02 10:53:31 +08:00
from datetime import datetime
from typing import Any, List
import pydantic
from pydantic import BaseModel
from sqlalchemy import Column, DateTime, String, Integer
from db.models.log_data_model import LOT_DATA_MODEL, LOT_DATA
class BaseResponse(BaseModel):
code: int = 200
msg: str = "success"
data: Any = None
class BaseModel:
"""
基础模型
"""
id = Column(Integer, primary_key=True, index=True, comment="主键ID")
create_time = Column(DateTime, default=datetime.utcnow, comment="创建时间")
update_time = Column(DateTime, default=None, onupdate=datetime.utcnow, comment="更新时间")
create_by = Column(String, default=None, comment="创建者")
update_by = Column(String, default=None, comment="更新者")