package com.railway.business.baseinfo.domain.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.railway.common.core.domain.entity.SysDept;
import java.util.List;
import java.util.stream.Collectors;
import lombok.Data;

/**
 * @author zhaomn
 */
@Data
public class CascadeDeptVo {

  private Long id;

  private String label;

  /**
   * 子节点
   */
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  private List<CascadeDeptVo> children;

  private List<CascadeLineVo> lineList;

  public CascadeDeptVo(SysDept dept) {
    this.id = dept.getDeptId();
    this.label = dept.getDeptName();
    this.children = dept.getChildren().stream().map(CascadeDeptVo::new).collect(Collectors.toList());
  }

}
