daily/Models/DailyModel.py

20 lines
907 B
Python

from sqlalchemy import Column, String, Boolean, Enum, Text, DateTime, func, Integer
from Utils.SqlAlchemyUtils import Base
class Daily(Base):
__tablename__ = "USER_TABLE"
openid = Column(String(255), primary_key=True, comment="用户OpenID")
type = Column(Enum(''))
email = Column(String(64), unique=True, index=True, comment="邮箱")
name = Column(String(32), comment="用户名")
department = Column(Text, comment="部门")
post = Column(Text, comment="职务")
disable = Column(Boolean, default=False, comment="禁用")
auth_data = Column(Text, comment="权限数据")
create_time = Column(DateTime, server_default=func.now(), comment='创建时间')
update_time = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment='修改时间')
def to_dict(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns}