package com.simuwang.manage.dto;

import cn.hutool.core.collection.ListUtil;
import com.simuwang.base.pojo.dos.sys.SysMenuDO;

import java.util.List;

/**
 * @author wangzaijun
 * @date 2024/9/13 8:41
 * @description 用户菜单树
 */
public class MenuTreeDTO {
    /**
     * 当前菜单id
     */
    private Integer id;
    /**
     * 父id
     */
    private Integer pid;
    /**
     * 排序，越小越靠前
     */
    private Integer sort;
    /**
     * 名称
     */
    private String name;
    /**
     * 唯一编码
     */
    private String code;
    /**
     * 路由
     */
    private String path;
    /**
     * 前端页面
     */
    private String component;
    /**
     * 路由参数
     */
    private String query;
    /**
     * 菜单类型,M-目录，C-菜单，F-按钮
     */
    private String menuType;
    /**
     * 是否为外链（1是 0否）
     */
    private Integer isFrame;
    /**
     * 是否缓存（1缓存 0不缓存）
     */
    private Integer isCache;
    /**
     * 显示状态（1显示 0隐藏）
     */
    private Integer visible;
    /**
     * 图标
     */
    private String icon;
    /**
     * 子菜单
     */
    private List<MenuTreeDTO> children;

    public MenuTreeDTO() {
        this.children = ListUtil.list(false);
    }

    public MenuTreeDTO(Integer id, String name, List<MenuTreeDTO> children) {
        this();
        this.id = id;
        this.name = name;
        this.children = children;
    }

    public MenuTreeDTO(SysMenuDO menuDO) {
        this();
        this.id = menuDO.getMenuId();
        this.name = menuDO.getMenuName();
        this.pid = menuDO.getParentId();
        this.code = menuDO.getPerms();
        this.sort = menuDO.getOrderNum();
        this.path = menuDO.getPath();
        this.component = menuDO.getComponent();
        this.query = menuDO.getQuery();
        this.menuType = menuDO.getMenuType();
        this.isFrame = menuDO.getIsFrame();
        this.isCache = menuDO.getIsCache();
        this.visible = menuDO.getVisible();
        this.icon = menuDO.getIcon();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getComponent() {
        return component;
    }

    public void setComponent(String component) {
        this.component = component;
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public List<MenuTreeDTO> getChildren() {
        return children;
    }

    public void setChildren(List<MenuTreeDTO> children) {
        this.children = children;
    }

    public String getMenuType() {
        return menuType;
    }

    public void setMenuType(String menuType) {
        this.menuType = menuType;
    }

    public Integer getIsFrame() {
        return isFrame;
    }

    public void setIsFrame(Integer isFrame) {
        this.isFrame = isFrame;
    }

    public Integer getIsCache() {
        return isCache;
    }

    public void setIsCache(Integer isCache) {
        this.isCache = isCache;
    }

    public Integer getVisible() {
        return visible;
    }

    public void setVisible(Integer visible) {
        this.visible = visible;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }
}
