Skip to content

Commit b872ea0

Browse files
committed
add SortRepository
1 parent a39998b commit b872ea0

File tree

1 file changed

+3
-1
lines changed
  • springboot-starter-data-fast/src/main/java/com/codingapi/springboot/fast/jpa/repository

1 file changed

+3
-1
lines changed

springboot-starter-data-fast/src/main/java/com/codingapi/springboot/fast/jpa/repository/SortRepository.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ public interface SortRepository<T extends ISort, ID> extends JpaRepository<T, ID
1515
default void reSort(SortRequest request) {
1616
if (request != null && !request.getIds().isEmpty()) {
1717
List<T> list = new ArrayList<>();
18-
int minSort = 0;
18+
int minSort = Integer.MAX_VALUE;
1919
for (Object objectId : request.getIds()) {
2020
ID id = (ID) objectId;
2121
T t = getReferenceById(id);
2222
if (t.getSort() != null && t.getSort() < minSort) {
2323
minSort = t.getSort();
24+
}else{
25+
minSort = 0;
2426
}
2527
list.add(t);
2628
}

0 commit comments

Comments
 (0)