|
@@ -64,7 +64,7 @@ public abstract class AbstractTreeSortService<E extends TreeSortSupportEntity<PK
|
|
|
}
|
|
|
|
|
|
protected void applyPath(E entity) {
|
|
|
- if (!StringUtils.isEmpty(entity.getParentId())) {
|
|
|
+ if (StringUtils.isEmpty(entity.getParentId())) {
|
|
|
return;
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(entity.getPath())) {
|
|
@@ -125,11 +125,11 @@ public abstract class AbstractTreeSortService<E extends TreeSortSupportEntity<PK
|
|
|
public PK saveOrUpdateForSingle(E entity) {
|
|
|
assertNotNull(entity);
|
|
|
PK id = entity.getId();
|
|
|
- applyPath(entity);
|
|
|
if (null == id || this.selectByPk(id) == null) {
|
|
|
if (null == id) {
|
|
|
entity.setId(getIDGenerator().generate());
|
|
|
}
|
|
|
+ applyPath(entity);
|
|
|
return super.insert(entity);
|
|
|
}
|
|
|
super.updateByPk(entity);
|