mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-13 15:12:09 +08:00
组织数据读取权限完成
This commit is contained in:
@@ -17,6 +17,7 @@ type (
|
||||
Delete(roleId []int64)
|
||||
GetRoleMeunId(data entity.SysRole) []int64
|
||||
GetRoleOrganizationId(data entity.SysRole) []int64
|
||||
FindOrganizationsByRoleId(roleId int64) (entity.SysRole, error)
|
||||
}
|
||||
|
||||
sysRoleModel struct {
|
||||
@@ -130,3 +131,14 @@ func (m *sysRoleModel) GetRoleOrganizationId(data entity.SysRole) []int64 {
|
||||
}
|
||||
return organizationIds
|
||||
}
|
||||
|
||||
func (m *sysRoleModel) FindOrganizationsByRoleId(roleId int64) (entity.SysRole, error) {
|
||||
var roleData entity.SysRole
|
||||
err := global.Db.Table(m.table).
|
||||
Select("sys_roles.data_scope, GROUP_CONCAT(sys_role_organizations.organization_id) as org").
|
||||
Joins("LEFT JOIN sys_role_organizations ON sys_roles.role_id = sys_role_organizations.role_id").
|
||||
Where("sys_roles.role_id = ?", roleId).
|
||||
Group("sys_roles.role_id").
|
||||
First(&roleData).Error
|
||||
return roleData, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user