package common.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.List;

@Entity
public class Menu {

	private Long id;
	// 授权处显示的名字
	private String name;
	// 对应的参数
	private String menu;
	
	private int orderIndex;

	private Long parent;

	private List<Menu> sons;


	public Menu() {
		super();
	}

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

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

	public String getName() {
		return name;
	}

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

	public String getMenu() {
		return menu;
	}

	public void setMenu(String menu) {
		this.menu = menu;
	}

	public Long getParent() {
		return parent;
	}

	public void setParent(Long parent) {
		this.parent = parent;
	}


	public int getOrderIndex() {
		return orderIndex;
	}

	public void setOrderIndex(int orderIndex) {
		this.orderIndex = orderIndex;
	}

	@Transient
	public List<Menu> getSons() {
		return sons;
	}

	public void setSons(List<Menu> sons) {
		this.sons = sons;
	}

	@Override
	public String toString() {
		return "Menu{" +
				"id=" + id +
				", name='" + name + '\'' +
				", menu='" + menu + '\'' +
				", orderIndex=" + orderIndex +
				", parent='" + parent + '\'' +
				'}';
	}
}
