package com.mortals.xhx.module.site.model;

import java.util.List;
import java.util.ArrayList;
import com.mortals.xhx.module.site.model.vo.SiteBusinessVo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.stream.Collectors;
/**
* 站点事项前端映射树结构实体类
*
* @author zxfei
* @date 2022-01-13
*/
@Data
public class SiteBusinessTreeSelect  implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
    * 节点ID
    */
    private Long id;

    /**
    * 节点名称
    */
    private String label;

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

    public SiteBusinessTreeSelect(SiteBusinessEntity entity) {
        this.id = entity.getId();
        this.label = entity.getBusinessName();
        this.children = entity.getChildren().stream().map(SiteBusinessTreeSelect::new).collect(Collectors.toList());
    }

}