mirror of https://gitee.com/stylefeng/roses
【8.3.3】【sys】【cache】更新用户的缓存操作
parent
17fd7544b5
commit
4af284608b
|
@ -148,6 +148,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
// 删除用户的业务操作
|
// 删除用户的业务操作
|
||||||
this.baseRemoveUser(CollectionUtil.set(false, sysUser.getUserId()));
|
this.baseRemoveUser(CollectionUtil.set(false, sysUser.getUserId()));
|
||||||
|
|
||||||
|
// 发布更新缓存事件,清空用户名称缓存
|
||||||
|
BusinessEventPublisher.publishEvent(UPDATE_USER_NAME_EVENT, sysUser.getUserId());
|
||||||
|
|
||||||
// 记录日志
|
// 记录日志
|
||||||
BusinessLogUtil.setLogTitle("删除用户,用户账号:" + sysUser.getAccount());
|
BusinessLogUtil.setLogTitle("删除用户,用户账号:" + sysUser.getAccount());
|
||||||
BusinessLogUtil.addContent("用户账号:", sysUser.getAccount());
|
BusinessLogUtil.addContent("用户账号:", sysUser.getAccount());
|
||||||
|
@ -171,6 +174,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
// 删除用户的业务操作
|
// 删除用户的业务操作
|
||||||
this.baseRemoveUser(userIdList);
|
this.baseRemoveUser(userIdList);
|
||||||
|
|
||||||
|
// 发布更新缓存事件,清空用户名称缓存
|
||||||
|
for (Long userId : userIdList) {
|
||||||
|
BusinessEventPublisher.publishEvent(UPDATE_USER_NAME_EVENT, userId.toString());
|
||||||
|
}
|
||||||
|
|
||||||
// 记录日志
|
// 记录日志
|
||||||
BusinessLogUtil.setLogTitle("批量删除用户");
|
BusinessLogUtil.setLogTitle("批量删除用户");
|
||||||
BusinessLogUtil.addContent("用户id集合为:\n", userIdList);
|
BusinessLogUtil.addContent("用户id集合为:\n", userIdList);
|
||||||
|
@ -500,12 +508,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
SysUser sysUser = this.getOne(sysUserLambdaQueryWrapper);
|
SysUser sysUser = this.getOne(sysUserLambdaQueryWrapper);
|
||||||
if (sysUser == null) {
|
if (sysUser == null) {
|
||||||
// 查询结果记录到缓存
|
// 查询结果记录到缓存
|
||||||
userNameCache.put(userId.toString(), "");
|
userNameCache.put(userId.toString(), "", SysConstants.DEFAULT_SYS_CACHE_TIMEOUT_SECONDS);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询结果记录到缓存
|
// 查询结果记录到缓存
|
||||||
userNameCache.put(userId.toString(), sysUser.getRealName());
|
userNameCache.put(userId.toString(), sysUser.getRealName(), SysConstants.DEFAULT_SYS_CACHE_TIMEOUT_SECONDS);
|
||||||
return sysUser.getRealName();
|
return sysUser.getRealName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue