package com.sysu.admin.support.tree;

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

import java.util.List;

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

    @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 title;

    @JSONField(ordinal = 6)
    private String icon;

    @JSONField(ordinal = 7)
    private String href;

    @JSONField(ordinal = 8)
    private Boolean spread;

    @JSONField(ordinal = 9)
    private List<NavigTree> list;

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