model
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import datetime
|
||||
from common.model import BaseModel, Column, String, Integer, DateTime, relationship, SQLAlchemyAutoSchema, backref
|
||||
|
||||
|
||||
class Role(BaseModel):
|
||||
__tablename__ = 'sys_role'
|
||||
id = Column(Integer, primary_key=True, comment='角色ID')
|
||||
name = Column(String(255), comment='角色名称')
|
||||
code = Column(String(255), comment='角色标识')
|
||||
enable = Column(Integer, comment='是否启用')
|
||||
remark = Column(String(255), comment='备注')
|
||||
details = Column(String(255), comment='详情')
|
||||
sort = Column(Integer, comment='排序')
|
||||
create_time = Column(DateTime, default=datetime.datetime.now, comment='创建时间')
|
||||
update_time = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')
|
||||
power = relationship('Power', secondary="sys_role_power", backref=backref('role'))
|
||||
|
||||
|
||||
class RoleSchema(SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Role
|
||||
include_fk = True
|
||||
load_instance = True
|
||||
Reference in New Issue
Block a user