feat: 部门管理添加按钮级权限控制,移除部门角色表

This commit is contained in:
2025-02-22 04:22:58 +08:00
parent 0c97feade2
commit a804732d53
6 changed files with 90 additions and 368 deletions

View File

@@ -118,38 +118,3 @@ class Department(BaseModel):
table = "department" # 数据库表名
table_description = "部门表" # 表描述
ordering = ["sort", "-create_time"] # 默认按排序权重和创建时间排序
class DepartmentRole(BaseModel):
"""
部门角色表模型。
"""
department = fields.ForeignKeyField(
"models.Department",
related_name="department_roles",
description="部门ID",
source_field="department_id" # 映射到数据库字段 department_id
)
"""
部门ID。
- 外键关联到 Department 表。
- 映射到数据库字段 department_id。
"""
role = fields.ForeignKeyField(
"models.Role",
related_name="department_roles",
description="角色ID",
source_field="role_id" # 映射到数据库字段 role_id
)
"""
角色ID。
- 外键关联到 Role 表。
- 映射到数据库字段 role_id。
"""
class Meta:
table = "department_role" # 数据库表名
table_description = "部门角色表" # 表描述
unique_together = (("department_id", "role_id"),) # 唯一约束,防止重复分配