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

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 区域前端映射树结构实体类
 *
 * @author zxfei
 * @date 2022-01-12
 */
@Data
public class AreaTreeSelect implements Serializable {
    private static final long serialVersionUID = 1L;

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

    /**
     * 节点名称
     */
    private String label;
    /**
     * 区域编码
     */
    private String areaCode;
    /**
     * 是否叶子节点
     */
    private Boolean isLeaf;

    /**
     * 节点类型
     */
    private String type;

    /**
     * 图标
     */
    private String icon;

    /**
     * 子节点
     */
    private List<AreaTreeSelect> children;

    public AreaTreeSelect(AreaEntity entity) {
        this.id = entity.getIid();
        this.label = entity.getName();
        if ("False".equalsIgnoreCase(entity.getHaveSonArea())) {
            this.isLeaf = true;
            this.children = new ArrayList();
        } else {
            this.isLeaf = false;
        }
        this.areaCode=entity.getAreaCode();
        this.type = "area";
        this.icon = "el-icon-folder";
    }


}