Menu 菜单
暨正真
2023-12-01
package com.reptile.bean.sys;
import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
/**
* @ClassName: Menu
* @Description: 菜单
* @author Bert
* @date 2013-01-13
*/
@Entity
@Table(name = "reptile_menu")
@GenericGenerator(name = "idGenerator", strategy = "uuid")
@DynamicInsert(true)
@DynamicUpdate(true)
public class Menu implements Serializable {
/**
*
*/
private static final long serialVersionUID = -248817122914405169L;
/**
* 编码
*/
private String id;
/**
* 菜单名称
*/
private String menuName;
/**
* 提示名称
*/
private String title;
/**
* 链接路径
*/
private String url;
/**
* 排序字段
*/
private Integer sortNumber = 0;
/**
* 目标框架
*/
private String target;
/**
* 使用的图标
*/
private String iconName;
/**
* 备注
*/
private String memo;
/**
* 建立用户编号
*/
private String createUserNO;
/**
* 父类
*/
private Menu menu;
/**
* 子类
**/
private Set<Menu> menus = new HashSet<Menu>();
/**
* 操作时间
*/
private Date createdate = new Date();
public Menu() {
super();
}
public Menu(String id) {
this.id = id;
}
@Id
@GeneratedValue(generator = "idGenerator")
@Column(name = "mu_id", length = 32)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Column(name = "mu_name", length = 150)
public String getMenuName() {
return menuName;
}
public void setMenuName(String menuName) {
this.menuName = menuName;
}
@Column(name = "mu_title", length = 150)
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Column(name = "mu_url", length = 300)
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
@Column(name = "mu_sort", length = 4)
public Integer getSortNumber() {
return sortNumber;
}
public void setSortNumber(Integer sortNumber) {
this.sortNumber = sortNumber;
}
@Column(name = "mu_target", length = 50)
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
@Column(name = "mu_icon", length = 150)
public String getIconName() {
return iconName;
}
public void setIconName(String iconName) {
this.iconName = iconName;
}
@Column(name = "mu_createUserNO", length = 32)
public String getCreateUserNO() {
return createUserNO;
}
public void setCreateUserNO(String createUserNO) {
this.createUserNO = createUserNO;
}
@Lob
@Column(name = "mu_memo")
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
@ManyToOne(cascade = CascadeType.REFRESH)
@JoinColumn(name = "mu_parentId")
public Menu getMenu() {
return menu;
}
public void setMenu(Menu menu) {
this.menu = menu;
}
@OneToMany(cascade = { CascadeType.REFRESH, CascadeType.REMOVE }, mappedBy = "menu")
public Set<Menu> getMenus() {
return menus;
}
public void setMenus(Set<Menu> menus) {
this.menus = menus;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "mu_createdate")
public Date getCreatedate() {
return createdate;
}
public void setCreatedate(Date createdate) {
this.createdate = createdate;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Menu other = (Menu) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}