Sfoglia il codice sorgente

如果已经指定了排序则不自动生成序号

zhouhao 2 anni fa
parent
commit
4f30e44f11

+ 3 - 1
hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java

@@ -224,7 +224,9 @@ public interface TreeSupportEntity<PK> extends Entity {
                     if (child instanceof SortSupportEntity && parent instanceof SortSupportEntity) {
                         SortSupportEntity sortableParent = ((SortSupportEntity) parent);
                         SortSupportEntity sortableChild = ((SortSupportEntity) child);
-                        sortableChild.setSortIndex(sortableParent.getSortIndex() * 100 + index++);
+                        if (sortableChild.getSortIndex() == null) {
+                            sortableChild.setSortIndex(sortableParent.getSortIndex() * 100 + index++);
+                        }
                     }
                     queue.add((T) child);
                 }