wd-smebiz/mods/smebiz_rate/company_user/models.py

29 lines
1.2 KiB
Python

import uuid
from datetime import datetime
from sqlalchemy.orm import relationship, mapped_column, Mapped
from context.common import common_db
from sqlalchemy import Column, Integer, Boolean, String, ForeignKey, Text, DateTime, func, Date, Double
from utils.sal_utils.model_config_utils import SalBase
class CompanyUser(common_db.Base, SalBase):
"""
企业用户表
"""
__tablename__ = "company_user"
id: Mapped[str] = mapped_column(String(255), primary_key=True, comment='用户ID', default=lambda: uuid.uuid4().hex)
email: Mapped[str] = mapped_column(String(255), comment="邮箱")
phone: Mapped[str] = mapped_column(String(255), comment="手机号")
company_name: Mapped[str] = mapped_column(String(255), comment="公司名称")
passwd: Mapped[str] = mapped_column(String(255), comment="hash密码")
credit: Mapped[str] = mapped_column(String(255), comment="统一社会信用代码")
verified: Mapped[bool] = mapped_column(Boolean, default=False, comment="是否通过验证")
create_time: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), comment='创建时间')
def to_dict(self):
data = {c.name: getattr(self, c.name) for c in self.__table__.columns}
return data