wip(semantic):数据模型语义化

This commit is contained in:
zhengxinonly
2021-09-06 02:17:36 +08:00
parent 27f5d78c35
commit 00053da117
31 changed files with 189 additions and 183 deletions
+5 -2
View File
@@ -1,8 +1,10 @@
import datetime
from applications.extensions import db
from ..base import BaseModel
class Power(db.Model):
class RightsPower(db.Model, BaseModel):
__tablename__ = 'rt_power'
id = db.Column(db.Integer, primary_key=True, comment='权限编号')
name = db.Column(db.String(255), comment='权限名称')
@@ -14,7 +16,8 @@ class Power(db.Model):
icon = db.Column(db.String(128), comment='图标')
sort = db.Column(db.Integer, comment='排序')
create_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建时间')
update_time = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新时间')
enable = db.Column(db.Integer, comment='是否开启')
parent = db.relationship("Power", remote_side=[id]) # 自关联
parent = db.relationship("RightsPower", remote_side=[id]) # 自关联