<commit_before>package com.jlfex.hermes.model;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jlfex.hermes.common.web.WebApp;

/**
 * 导航信息模型
 */
@Entity
@Table(name = "hm_navigation", uniqueConstraints = { @UniqueConstraint(columnNames = "code") })
public class Navigation extends Model {

	private static final long serialVersionUID = 842883061234188375L;
	private static final String PREFIX = "@";

	/** 父级 */
	@ManyToOne
	@JoinColumn(name = "parent")
	@JsonIgnore
	private Navigation parent;

	/** 类型 */
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "type")
	@JsonIgnore
	private Dictionary type;

	/** 名称 */
	@Column(name = "name")
	private String name;

	/** 副称 */
	@Column(name = "subname")
	private String subname;

	/** 代码 */
	@Column(name = "code")
	private String code;

	/** 地址 */
	@Column(name = "path")
	private String path;

	/** 目标 */
	@Column(name = "target")
	private String target;

	/** 顺序 */
	@Column(name = "order_")
	private Integer order;

	/** 子集 */
	@OneToMany(mappedBy = "parent", fetch = FetchType.EAGER)
	@OrderBy(value = " order asc")
	private List<Navigation> children = new LinkedList<Navigation>();

	/**
	 * 某一角色是否含有该权限
	 */
	@Transient
	private boolean isHavingByRole = false;

	/**
	 * 某一软件模式是否还有该权限
	 */
	@Transient
	private boolean isHavingBySoftModel = true;

	/**
	 * 读取父级
	 * 
	 * @return
	 * @see #parent
	 */
	public Navigation getParent() {
		return parent;
	}

	/**
	 * 设置父级
	 * 
	 * @param parent
	 * @see #parent
	 */<commit_msg>优化后台菜单显示:懒加载<commit_after>package com.jlfex.hermes.model;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jlfex.hermes.common.web.WebApp;

/**
 * 导航信息模型
 */
@Entity
@Table(name = "hm_navigation", uniqueConstraints = { @UniqueConstraint(columnNames = "code") })
public class Navigation extends Model {

	private static final long serialVersionUID = 842883061234188375L;
	private static final String PREFIX = "@";

	/** 父级 */
	@ManyToOne
	@JoinColumn(name = "parent")
	@JsonIgnore
	private Navigation parent;

	/** 类型 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type")
	@JsonIgnore
	private Dictionary type;

	/** 名称 */
	@Column(name = "name")
	private String name;

	/** 副称 */
	@Column(name = "subname")
	private String subname;

	/** 代码 */
	@Column(name = "code")
	private String code;

	/** 地址 */
	@Column(name = "path")
	private String path;

	/** 目标 */
	@Column(name = "target")
	private String target;

	/** 顺序 */
	@Column(name = "order_")
	private Integer order;

	/** 子集 */
	@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY)
	@OrderBy(value = " order asc")
	private List<Navigation> children = new LinkedList<Navigation>();

	/**
	 * 某一角色是否含有该权限
	 */
	@Transient
	private boolean isHavingByRole = false;

	/**
	 * 某一软件模式是否还有该权限
	 */
	@Transient
	private boolean isHavingBySoftModel = true;

	/**
	 * 读取父级
	 * 
	 * @return
	 * @see #parent
	 */
	public Navigation getParent() {
		return parent;
	}

	/**
	 * 设置父级
	 * 
	 * @param parent
	 * @see #parent
	 */
{'fraction_non_alphanumeric': 0.13837300549306827, 'fraction_numerical': 0.00941668846455663, 'mean_word_length': 4.1328859060402685, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4044168', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1405, 'n_words': 290}