feat: 部门管理添加按钮级权限控制,移除部门角色表
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
# @Comment : 本程序
|
||||
|
||||
from models.config import Config
|
||||
from models.department import Department, DepartmentRole
|
||||
from models.department import Department
|
||||
from models.file import File
|
||||
from models.i18n import I18n, Locale
|
||||
from models.log import LoginLog, OperationLog
|
||||
@@ -17,7 +17,6 @@ from models.user import User, UserRole
|
||||
|
||||
__all__ = [
|
||||
'Department',
|
||||
'DepartmentRole',
|
||||
'File',
|
||||
'LoginLog',
|
||||
'OperationLog',
|
||||
|
||||
@@ -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"),) # 唯一约束,防止重复分配
|
||||
|
||||
Reference in New Issue
Block a user