menu_model.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from datetime import datetime
  2. from sqlalchemy import Column, Integer, String, DateTime, Table, ForeignKey, UniqueConstraint
  3. from app.models.base_model import Base
  4. class WebMenuModel(Base):
  5. __tablename__ = 'web_menu'
  6. id = Column(Integer, primary_key=True, index=True)
  7. title = Column(String(128))
  8. describe = Column(String(1000))
  9. desc = Column(String(1000))
  10. icon = Column(String(16))
  11. img = Column(String(255))
  12. def to_dict(self):
  13. return {
  14. 'id': self.id,
  15. 'title': self.title,
  16. 'icon': self.icon,
  17. 'img': self.img,
  18. 'desc': self.desc,
  19. 'dialog': self.describe
  20. }
  21. def __repr__(self):
  22. return '<Role name:%r description:%r iconCls:%r seq:%r>\n' \
  23. % (self.NAME, self.DESCRIPTION, self.ICONCLS, self.SEQ)
  24. class MenuCapacityModel(Base):
  25. __tablename__ = 'menu_capacity'
  26. __table_args__ = (UniqueConstraint('menu_id', 'capacity_id', name='menu_capacity_id_ix'),)
  27. id = Column(Integer, primary_key=True, index=True)
  28. menu_id = Column(Integer)
  29. capacity_id = Column(String(36))
  30. capacity_type = Column(Integer)