package com.lxzn.framework.domain.nc.ext; import com.fasterxml.jackson.annotation.JsonIgnore; import com.lxzn.framework.domain.nc.ComponentInfo; import com.lxzn.framework.utils.BeanMapper; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.util.List; @Data @NoArgsConstructor @EqualsAndHashCode(callSuper = false) public class ComponentExt extends ComponentInfo { private ComponentExt parent; private List children; @JsonIgnore private String userId; public boolean hasChild() { boolean b = true; if(this.getChildren() == null || this.getChildren().size() < 1) { b = false; } return b; } public List getAllChildren(List list) { if(this.hasChild()) { List extList = this.getChildren(); for(ComponentExt ext : extList) { list = ext.getAllChildren(list); } ComponentInfo en = new ComponentInfo(); BeanMapper.copy(this, en); list.add(en); }else { ComponentInfo en = new ComponentInfo(); BeanMapper.copy(this, en); list.add(en); } return list; } }