新增管理员即赋予权限无法生效问题处理。直播间未登录用户报错问题处理

This commit is contained in:
Chopper 2021-06-29 16:26:52 +08:00
parent 3ee3e49d0b
commit c1b9f287c7
2 changed files with 4 additions and 5 deletions

View File

@ -200,7 +200,7 @@ public class StudioServiceImpl extends ServiceImpl<StudioMapper, Studio> impleme
.eq(recommend != null, "recommend", true) .eq(recommend != null, "recommend", true)
.eq(status != null, "status", status) .eq(status != null, "status", status)
.orderByDesc("create_time"); .orderByDesc("create_time");
if (UserContext.getCurrentUser()!=null&&UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { if (UserContext.getCurrentUser() != null && UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) {
queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId()); queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId());
} }
return this.page(PageUtil.initPage(pageVO), queryWrapper); return this.page(PageUtil.initPage(pageVO), queryWrapper);

View File

@ -199,13 +199,12 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
if (roles.size() > 10) { if (roles.size() > 10) {
throw new ServiceException(ResultCode.PERMISSION_BEYOND_TEN); throw new ServiceException(ResultCode.PERMISSION_BEYOND_TEN);
} }
if (roles != null && roles.size() > 0) { if (roles.size() > 0) {
dbUser.setRoleIds(StringUtils.join(",", roles)); dbUser.setRoleIds(StringUtils.join(",", roles));
} }
this.save(dbUser); this.save(dbUser);
updateRole(adminUser.getId(), roles); dbUser = this.findByUsername(dbUser.getUsername());
updateRole(dbUser.getId(), roles);
} }