package com.sysu.admin.support.tree;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Builder;
import lombok.Data;

import java.util.List;

/**
 * @title MenuTree
 * @description
 * @author XIE
 * @date 2020年4月24日下午10:03:43
 */
@Data
@Builder
public class MenuTree implements Comparable<MenuTree> {

    @JSONField(ordinal = 1)
    private Long id;

    @JSONField(ordinal = 2)
    private Long parent;

    @JSONField(ordinal = 3)
    private Integer sort;

    //

    @JSONField(ordinal = 4)
    private String name;

    @JSONField(ordinal = 5)
    private String value;

    @JSONField(ordinal = 6)
    private Boolean disabled;

    @JSONField(ordinal = 7)
    private Boolean selected;

    @JSONField(ordinal = 8)
    private List<MenuTree> children;

    @Override
    public int compareTo(MenuTree o) {
        if (null == o) {
            return 1;
        }
        return this.sort - o.sort;
    }
}
