feat:实现相当牛逼的链式反应

This commit is contained in:
wangyu 2021-12-22 21:41:16 +08:00
parent c2ac1f88d8
commit 23fbdbccf6
4 changed files with 13 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import lombok.Getter;
@AllArgsConstructor
public enum UserStatus implements NamedEnum {
NORMAL("正常状态"), LOCKED("已锁定"), DISABLED("已禁用"), EXPIRED("已过期");
NORMAL("正常"), LOCKED("已锁定"), DISABLED("已禁用"), EXPIRED("已过期");
private final String name;
}

View File

@ -5,6 +5,10 @@ import com.flyfish.framework.domain.authorized.AuthorizedDomain;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
/**
* 作用域赋值审查
* @author wangyu
*/
@Component
@RequiredArgsConstructor
public class AuthorizeAuditor implements BeanAuditor<AuthorizedDomain> {
@ -15,7 +19,6 @@ public class AuthorizeAuditor implements BeanAuditor<AuthorizedDomain> {
* 对实体进行审查并补全相关字段
*
* @param data 原数据
* @return 结果
*/
@Override
public void audit(AuthorizedDomain data) {

View File

@ -36,6 +36,10 @@ public abstract class TreeController<T extends TreeDomain<T>, Q extends TreeQo<T
// 第三步筛选一级树深度
List<T> topList = filtered.stream().filter(item -> null != item && TreeDomain.ROOT.equals(item.getParentId()))
.collect(Collectors.toList());
// 不是从根开始直接查出
if (CollectionUtils.isEmpty(topList)) {
return Result.accept(filtered);
}
// 第三步根据父id的map填充根tree
return Result.accept(applyChildren(topList, group));
}

View File

@ -68,6 +68,10 @@ public abstract class ReactiveTreeController<T extends TreeDomain<T>, Q extends
List<T> roots = filtered.stream()
.filter(item -> null != item && TreeDomain.ROOT.equals(item.getParentId()))
.collect(Collectors.toList());
// 不是从根开始直接查出
if (CollectionUtils.isEmpty(roots)) {
return filtered;
}
// 第四步根据父id的map填充根tree
return applyChildren(roots, group);
}