refactor🎨:注释未使用的对象

This commit is contained in:
zhangwenjian committed 2021-06-17 11:28:37 +08:00
1 parent d32751ea5d
commit 3358eeb54c
6 files changed
+19 -14

No files matched your search

+5 -3
View File
@@ -204,8 +204,10 @@ func (e *SysRole) UpdateDataScope(c *dto.RoleDataScopeReq) *SysRole {
}()
var dlist = make([]models.SysDept, 0)
var model = models.SysRole{}
tx.Preload("SysDept").First(&model, c.DeptIds)
tx.Where("id in ?", c.DeptIds).Find(&dlist)
tx.Preload("SysDept").First(&model, c.RoleId)
if c.DataScope == "2" {
tx.Where("dept_id in ?", c.DeptIds).Find(&dlist)
}
err = tx.Model(&model).Association("SysDept").Delete(model.SysDept)
if err != nil {
e.Log.Errorf("delete SysDept error:%s", err)
@@ -290,4 +292,4 @@ func (e *SysRole) GetById(roleId int) ([]string, error) {
permissions = append(permissions, l[i].Permission)
}
return permissions, nil
}
}