2023-08-02 16:32:36 +08:00
|
|
|
from datetime import datetime
|
|
|
|
|
2023-08-02 14:24:28 +08:00
|
|
|
from context.common import common_db
|
2023-08-02 10:18:36 +08:00
|
|
|
from sqlalchemy import Column, Integer, String, DateTime, func
|
2023-08-02 16:32:36 +08:00
|
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
2023-08-02 10:18:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
class FormFile(common_db.Base):
|
|
|
|
__tablename__ = 'form_file'
|
2023-08-02 16:32:36 +08:00
|
|
|
md: Mapped[str] = mapped_column(String(255), primary_key=True, comment='文件md')
|
|
|
|
file_name: Mapped[str] = mapped_column(String(255), comment='文件名称')
|
|
|
|
mime_type: Mapped[str] = mapped_column(String(255), comment='文件mime_type')
|
|
|
|
user_id: Mapped[str] = mapped_column(String(255), comment='上传的用户id')
|
|
|
|
common_type: Mapped[str] = mapped_column(String(255), comment='大分类的文件类型')
|
|
|
|
create_time: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), comment='上传时间')
|
|
|
|
file_url: Mapped[str] = mapped_column(String(500), comment='文件链接')
|
|
|
|
# company_user:Mapped['CompanyUser'] = relationship(back_populates="form_file")
|
2023-08-02 10:18:36 +08:00
|
|
|
def to_dict(self):
|
|
|
|
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
|