项目初始导入
This commit is contained in:
79
src/main/java/com/nis/domain/TreeEntity.java
Normal file
79
src/main/java/com/nis/domain/TreeEntity.java
Normal file
@@ -0,0 +1,79 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user