package com.izouma.dingdong.domain;

import lombok.Data;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

@Data
@Entity
@Where(clause = "active = 1")
public class Menu extends BaseEntity implements Serializable {
    private String name;

    private String path;

    private String icon;

    private Integer sort;

    private Long parent;

    private Boolean root;

    private Boolean enabled;

    private Boolean active;

    @OneToMany
    @JoinColumn(name = "parent", insertable = false, updatable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    List<Menu> children;
}
