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

import java.util.List;
import java.util.ArrayList;
import com.mortals.xhx.module.business.model.vo.BusinessVo;
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 BusinessTreeSelect  implements Serializable {
    private static final long serialVersionUID = 1L;

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

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

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

    public BusinessTreeSelect(BusinessEntity entity) {
        this.id = entity.getId();
        this.label = entity.getName();
        this.children = entity.getChildren().stream().map(BusinessTreeSelect::new).collect(Collectors.toList());
    }

}