fixed:切换角色功能适配新版gorm

This commit is contained in:
pixelmaxQM
2024-04-14 23:43:03 +08:00
parent 1ece13c43d
commit 24db0eb5aa
3 changed files with 4 additions and 4 deletions

View File

@@ -106,7 +106,7 @@ func (userService *UserService) SetUserAuthority(id uint, authorityId uint) (err
if errors.Is(assignErr, gorm.ErrRecordNotFound) {
return errors.New("该用户无此角色")
}
err = global.GVA_DB.Where("id = ?", id).First(&system.SysUser{}).Update("authority_id", authorityId).Error
err = global.GVA_DB.Model(&system.SysUser{}).Where("id = ?", id).Update("authority_id", authorityId).Error
return err
}