123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import datetime
- from sqlalchemy import (Integer, Column, String, BOOLEAN, DateTime,
- UniqueConstraint)
- from db.base import Base
- class SysModule(Base):
- id = Column(Integer, primary_key=True, autoincrement=True)
- name = Column(String(32), nullable=False, comment="模块名称")
- pid = Column(Integer, default=0, comment="上级模块ID")
- level = Column(Integer, nullable=False, default=0, comment="模块层级")
- creator = Column(Integer, comment="创建人")
- editor = Column(Integer, comment="最后编辑人")
- created_at = Column(DateTime, default=datetime.datetime.now)
- updated_at = Column(DateTime,
- default=datetime.datetime.now,
- onupdate=datetime.datetime.now)
- __table_args__ = (UniqueConstraint("name",
- "pid",
- "level",
- name="uix_name_pid_level"),)
- class SysAPI(Base):
- id = Column(Integer, primary_key=True, autoincrement=True)
- name = Column(String(32), nullable=False, comment="接口名称")
- path = Column(String(128), nullable=False, comment="接口路径")
- method = Column(String(10), nullable=False, comment="接口方法")
- module_id = Column(Integer, nullable=False, comment="所属模块ID")
- is_active = Column(BOOLEAN(), default=True, comment="是否激活")
- creator = Column(Integer, comment="创建人")
- editor = Column(Integer, comment="最后编辑人")
- created_at = Column(DateTime, default=datetime.datetime.now)
- updated_at = Column(DateTime,
- default=datetime.datetime.now,
- onupdate=datetime.datetime.now)
- __table_args__ = (UniqueConstraint("module_id",
- "path",
- "method",
- name="uix_module_path_method"),)
|