mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-05-19 22:37:00 +08:00
优化空判断
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.hswebframework.web.system.authorization.defaults.service;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.hswebframework.ezorm.core.param.QueryParam;
|
||||
import org.hswebframework.ezorm.rdb.mapping.ReactiveRepository;
|
||||
import org.hswebframework.web.api.crud.entity.TransactionManagers;
|
||||
@@ -124,12 +125,14 @@ public class DefaultReactiveUserService extends GenericReactiveCrudService<UserE
|
||||
public Mono<Integer> changeState(Publisher<String> userId, byte state) {
|
||||
return Flux.from(userId)
|
||||
.collectList()
|
||||
.filter(CollectionUtils::isNotEmpty)
|
||||
.flatMap(list -> repository
|
||||
.createUpdate()
|
||||
.set(UserEntity::getStatus, state)
|
||||
.where()
|
||||
.in(UserEntity::getId, list)
|
||||
.execute());
|
||||
.execute())
|
||||
.defaultIfEmpty(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,8 +171,8 @@ public class DefaultReactiveUserService extends GenericReactiveCrudService<UserE
|
||||
public Mono<Boolean> deleteUser(String userId) {
|
||||
return this.findById(userId)
|
||||
.flatMap(user -> this
|
||||
.deleteById(Mono.just(userId))
|
||||
.doOnNext(i -> eventPublisher.publishEvent(new UserDeletedEvent(user)))
|
||||
.thenReturn(true));
|
||||
.deleteById(Mono.just(userId))
|
||||
.doOnNext(i -> eventPublisher.publishEvent(new UserDeletedEvent(user)))
|
||||
.thenReturn(true));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user