This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/java/com/nis/domain/TreeEntity.java
2017-12-29 16:18:40 +08:00

80 lines
1.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.nis.domain;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.nis.util.Reflections;
import com.nis.util.StringUtil;
/**
* 数据Entity类
* @author ThinkGem
* @version 2014-05-16
*/
public abstract class TreeEntity<T> extends BaseEntity<T> {
private static final long serialVersionUID = 1L;
protected T parent; // 父级编号
protected String parentIds; // 所有父级编号
protected String name; // 机构名称
protected Long sort; // 排序
public TreeEntity() {
super();
this.sort = 30L;
}
public TreeEntity(Long id) {
super(id);
}
/**
* 父对象只能通过子类实现父类实现mybatis无法读取
* @return
*/
@JsonBackReference
public abstract T getParent();
/**
* 父对象只能通过子类实现父类实现mybatis无法读取
* @return
*/
public abstract void setParent(T parent);
public String getParentIds() {
return parentIds;
}
public void setParentIds(String parentIds) {
this.parentIds = parentIds;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getSort() {
return sort;
}
public void setSort(Long sort) {
this.sort = sort;
}
public Long getParentId() {
Long id = null;
if (parent != null){
id = (Long)Reflections.getFieldValue(parent, "id");
}
return StringUtil.isEmpty(id) ? 0 : id;
}
}