|
@@ -67,6 +67,7 @@ public abstract class AbstractTreeSortService<E extends TreeSortSupportEntity<PK
|
|
if (StringUtils.isEmpty(entity.getParentId())) {
|
|
if (StringUtils.isEmpty(entity.getParentId())) {
|
|
entity.setSortIndex(0L);
|
|
entity.setSortIndex(0L);
|
|
entity.setParentId(createParentIdOnExists());
|
|
entity.setParentId(createParentIdOnExists());
|
|
|
|
+ entity.setLevel(0);
|
|
entity.setPath(RandomUtil.randomChar(4));
|
|
entity.setPath(RandomUtil.randomChar(4));
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -80,10 +81,12 @@ public abstract class AbstractTreeSortService<E extends TreeSortSupportEntity<PK
|
|
entity.setSortIndex(0L);
|
|
entity.setSortIndex(0L);
|
|
entity.setParentId(createParentIdOnExists());
|
|
entity.setParentId(createParentIdOnExists());
|
|
entity.setPath(RandomUtil.randomChar(4));
|
|
entity.setPath(RandomUtil.randomChar(4));
|
|
|
|
+ entity.setLevel(0);
|
|
} else {
|
|
} else {
|
|
if (entity.getSortIndex() == null && parent.getSortIndex() != null)
|
|
if (entity.getSortIndex() == null && parent.getSortIndex() != null)
|
|
entity.setSortIndex(parent.getSortIndex() * 10);
|
|
entity.setSortIndex(parent.getSortIndex() * 10);
|
|
entity.setPath(parent.getPath() + "-" + RandomUtil.randomChar(4));
|
|
entity.setPath(parent.getPath() + "-" + RandomUtil.randomChar(4));
|
|
|
|
+ entity.setLevel(entity.getPath().split("-").length);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|