|
@@ -68,7 +68,19 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean delUserByIds(Long[] ids) {
|
|
|
for (Long id : ids) {
|
|
|
- //批量删除附件
|
|
|
+ UserEntity userEntity = findUserById(id);
|
|
|
+ if (userEntity != null) {
|
|
|
+ //將禁用的角色放入redis,作为登出判断
|
|
|
+ if (userEntity.getEnableState().equals("0")) {
|
|
|
+ String roleKey = "disableUser:" + id;
|
|
|
+ redisUtil.setExpire(roleKey.getBytes(), ByteArrayUtils.objectToBytes("1").get(), 60 * 60 * 24);//15分钟过期
|
|
|
+
|
|
|
+ }
|
|
|
+ if (userEntity.getEnableState().equals("1")) {
|
|
|
+ String roleKey = "disableUser:" + id;
|
|
|
+ redisUtil.del(roleKey.getBytes());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return this.removeByIds(Arrays.asList(ids));
|
|
|
}
|
|
@@ -96,7 +108,19 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
|
|
|
* 单个删除
|
|
|
*/
|
|
|
public boolean delUserById(Long id) {
|
|
|
- //todo 移除附件
|
|
|
+ UserEntity userEntity = findUserById(id);
|
|
|
+ if (userEntity != null) {
|
|
|
+ //將禁用的角色放入redis,作为登出判断
|
|
|
+ if (userEntity.getEnableState().equals("0")) {
|
|
|
+ String roleKey = "disableUser:" + id;
|
|
|
+ redisUtil.setExpire(roleKey.getBytes(), ByteArrayUtils.objectToBytes("1").get(), 60 * 60 * 24);//15分钟过期
|
|
|
+
|
|
|
+ }
|
|
|
+ if (userEntity.getEnableState().equals("1")) {
|
|
|
+ String roleKey = "disableUser:" + id;
|
|
|
+ redisUtil.del(roleKey.getBytes());
|
|
|
+ }
|
|
|
+ }
|
|
|
return this.removeById(id);
|
|
|
}
|
|
|
|