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

29 lines
1.2 KiB
Python
Raw Normal View History

2023-08-02 10:18:36 +08:00
import uuid
2023-08-02 16:32:36 +08:00
from datetime import datetime
2023-08-02 10:18:36 +08:00
2023-08-02 16:32:36 +08:00
from sqlalchemy.orm import relationship, mapped_column, Mapped
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, Boolean, String, ForeignKey, Text, DateTime, func, Date, Double
2023-08-02 16:32:36 +08:00
from utils.sal_utils.model_config_utils import SalBase
2023-08-02 10:18:36 +08:00
2023-08-02 16:32:36 +08:00
class CompanyUser(common_db.Base, SalBase):
2023-08-02 10:18:36 +08:00
"""
企业用户表
"""
__tablename__ = "company_user"
2023-08-02 16:32:36 +08:00
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='创建时间')
2023-08-02 10:18:36 +08:00
def to_dict(self):
data = {c.name: getattr(self, c.name) for c in self.__table__.columns}
return data