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 @AllArgsConstructor
public enum UserStatus implements NamedEnum { public enum UserStatus implements NamedEnum {
NORMAL("正常状态"), LOCKED("已锁定"), DISABLED("已禁用"), EXPIRED("已过期"); NORMAL("正常"), LOCKED("已锁定"), DISABLED("已禁用"), EXPIRED("已过期");
private final String name; private final String name;
} }

View File

@ -5,6 +5,10 @@ import com.flyfish.framework.domain.authorized.AuthorizedDomain;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
* 作用域赋值审查
* @author wangyu
*/
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class AuthorizeAuditor implements BeanAuditor<AuthorizedDomain> { public class AuthorizeAuditor implements BeanAuditor<AuthorizedDomain> {
@ -15,7 +19,6 @@ public class AuthorizeAuditor implements BeanAuditor<AuthorizedDomain> {
* 对实体进行审查并补全相关字段 * 对实体进行审查并补全相关字段
* *
* @param data 原数据 * @param data 原数据
* @return 结果
*/ */
@Override @Override
public void audit(AuthorizedDomain data) { 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())) List<T> topList = filtered.stream().filter(item -> null != item && TreeDomain.ROOT.equals(item.getParentId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 不是从根开始直接查出
if (CollectionUtils.isEmpty(topList)) {
return Result.accept(filtered);
}
// 第三步根据父id的map填充根tree // 第三步根据父id的map填充根tree
return Result.accept(applyChildren(topList, group)); 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() List<T> roots = filtered.stream()
.filter(item -> null != item && TreeDomain.ROOT.equals(item.getParentId())) .filter(item -> null != item && TreeDomain.ROOT.equals(item.getParentId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 不是从根开始直接查出
if (CollectionUtils.isEmpty(roots)) {
return filtered;
}
// 第四步根据父id的map填充根tree // 第四步根据父id的map填充根tree
return applyChildren(roots, group); return applyChildren(roots, group);
} }