规范数据库,解决bug
This commit is contained in:
@@ -18,7 +18,7 @@ public class BaseNode<T> implements INode<T> {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
protected String id;
|
||||
protected int id;
|
||||
|
||||
/**
|
||||
* 父节点ID
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ForestNode extends BaseNode<ForestNode> {
|
||||
*/
|
||||
private Object content;
|
||||
|
||||
public ForestNode(String id, String parentId, Object content) {
|
||||
public ForestNode(int id, String parentId, Object content) {
|
||||
this.id = id;
|
||||
this.parentId = parentId;
|
||||
this.content = content;
|
||||
|
||||
@@ -17,12 +17,12 @@ public class ForestNodeManager<T extends INode<T>> {
|
||||
/**
|
||||
* 森林的所有节点
|
||||
*/
|
||||
private final ImmutableMap<String, T> nodeMap;
|
||||
private final ImmutableMap<Integer, T> nodeMap;
|
||||
|
||||
/**
|
||||
* 森林的父节点ID
|
||||
*/
|
||||
private final Map<String, Object> parentIdMap = Maps.newHashMap();
|
||||
private final Map<Integer, Object> parentIdMap = Maps.newHashMap();
|
||||
|
||||
public ForestNodeManager(List<T> nodes) {
|
||||
nodeMap = Maps.uniqueIndex(nodes, INode::getId);
|
||||
@@ -46,7 +46,7 @@ public class ForestNodeManager<T extends INode<T>> {
|
||||
*
|
||||
* @param parentId 父节点ID
|
||||
*/
|
||||
public void addParentId(String parentId) {
|
||||
public void addParentId(int parentId) {
|
||||
parentIdMap.put(parentId, "");
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface INode<T> extends Serializable {
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
String getId();
|
||||
int getId();
|
||||
|
||||
/**
|
||||
* 父主键
|
||||
|
||||
Reference in New Issue
Block a user