refactor(backend): 统一返回的数据格式

This commit is contained in:
zhengxinonly
2025-07-08 22:16:12 +08:00
parent 65e41ac9f1
commit fa69175e65
18 changed files with 212 additions and 113 deletions
+2 -11
View File
@@ -5,10 +5,10 @@ from ._base import BaseORM
class DepartmentORM(BaseORM):
__tablename__ = "ums_department"
id = db.Column(db.Integer, primary_key=True, comment="部门ID")
id = db.Column(db.Integer, primary_key=True, comment="部门 ID")
name = db.Column(db.String(50), comment="部门名称")
leader = db.Column(db.String(50), comment="负责人")
enable = db.Column(db.Boolean, comment="状态(1开启,0关闭)", default=True)
enable = db.Column(db.Boolean, comment="状态 (1 开启0 关闭)", default=True)
users = db.relationship("UserORM", backref="department")
@@ -17,12 +17,3 @@ class DepartmentORM(BaseORM):
"DepartmentORM", back_populates="children", remote_side=[id]
) # 自关联
children = db.relationship("DepartmentORM", back_populates="parent")
def json(self):
return {
"id": self.id,
"pid": self.pid,
"name": self.name,
"leader": self.leader,
"enable": self.enable,
}