You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
webcrawler/db/src/main/java/db/model/bilibili/MenuModel.java

127 lines
2.5 KiB

package db.model.bilibili;
import db.annotation.Aliyun;
import db.model.AbstractModel;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
@Aliyun
@Entity
@Table(name = "menu")
public class MenuModel extends AbstractModel {
private int id;
private String href;
private String menuName;
private String icon;
private int parentId;
private List<MenuModel> childMenu;
private int menuLevel;
private int sort;
@Id
@Column(name = "id")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Basic
@Column(name = "href")
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
@Basic
@Column(name = "menu_name")
public String getMenuName() {
return menuName;
}
public void setMenuName(String menuName) {
this.menuName = menuName;
}
@Basic
@Column(name = "icon")
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MenuModel menuModel = (MenuModel) o;
return id == menuModel.id &&
Objects.equals(href, menuModel.href) &&
Objects.equals(menuName, menuModel.menuName) &&
Objects.equals(icon, menuModel.icon);
}
@Override
public int hashCode() {
return Objects.hash(id, href, menuName, icon);
}
@Override
public Serializable primaryKey() {
return getId();
}
@Basic
@Column(name = "parent_id")
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
@OneToMany
@JoinColumn(name = "parent_id")
@OrderBy("sort asc")
public List<MenuModel> getChildMenu() {
return childMenu;
}
public void setChildMenu(List<MenuModel> childMenu) {
this.childMenu = childMenu;
}
@Basic
@Column(name = "menu_level")
public int getMenuLevel() {
return menuLevel;
}
public void setMenuLevel(int menuLevel) {
this.menuLevel = menuLevel;
}
@Basic
@Column(name = "sort")
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
}