package com.sundot.airport.common.core.domain;

import java.util.List;
import java.util.stream.Collectors;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.sundot.airport.common.constant.UserConstants;
import com.sundot.airport.common.core.domain.entity.SysDept;
import com.sundot.airport.common.core.domain.entity.SysUser;
import com.sundot.airport.common.utils.StringUtils;

/**
 * 部门用户树结构实体类
 * 
 * @author ruoyi
 */
public class DeptUserTreeSelect extends TreeSelect {
    private static final long serialVersionUID = 1L;

    /** 节点类型（dept-部门 user-用户） */
    private String nodeType;

    public DeptUserTreeSelect() {
        super();
    }

    /**
     * 部门节点构造方法
     * 
     * @param dept 部门信息
     */
    public DeptUserTreeSelect(SysDept dept) {
        super();
        this.setId(dept.getDeptId());
        this.setLabel(dept.getDeptName());
        this.setParentId(dept.getParentId());
        this.setDeptType(dept.getDeptType());
        this.nodeType = "dept";
        this.setDisabled(StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()));
    }

    /**
     * 用户节点构造方法
     * 
     * @param user 用户信息
     */
    public DeptUserTreeSelect(SysUser user) {
        super();
        this.setId(user.getUserId());
        this.setLabel(user.getNickName());
        this.setParentId(user.getDeptId());
        this.nodeType = "user";
    }

    public String getNodeType() {
        return nodeType;
    }

    public void setNodeType(String nodeType) {
        this.nodeType = nodeType;
    }
}