fix order

This commit is contained in:
Chuck1sn
2025-05-16 15:49:13 +08:00
parent 5b8f262450
commit 0226e329d4
3 changed files with 15 additions and 10 deletions

View File

@@ -68,11 +68,16 @@ public class PageRequestDto {
}
public List<SortField<Object>> getSortFields() {
return sortBy.entrySet().stream()
.map(
(entry) ->
field(name(entry.getKey())).sort(SortOrder.valueOf(entry.getValue().getKeyword())))
.toList();
List<SortField<Object>> sortFields = sortBy.entrySet().stream()
.map(
(entry) ->
field(name(entry.getKey())).sort(SortOrder.valueOf(entry.getValue().getKeyword())))
.toList();
if (sortFields.isEmpty()) {
return List.of(field(name("id")).sort(SortOrder.ASC));
} else {
return sortFields;
}
}
private void checkPageAndSize(int page, int size) {

View File

@@ -38,7 +38,7 @@ public class QrtzJobRepository extends QrtzJobDetailsDao {
StringUtils.isNotEmpty(queryDto.name())
? QRTZ_JOB_DETAILS.SCHED_NAME.eq(queryDto.name())
: noCondition())
.orderBy(pageRequestDto.getSortFields())
.orderBy(QRTZ_JOB_DETAILS.qrtzTriggers().TRIGGER_NAME)
.limit(pageRequestDto.getSize())
.offset(pageRequestDto.getOffset())
.fetch();

View File

@@ -1,11 +1,11 @@
VITE_APP_PORT=5173
VITE_SOURCE_MAP=true
# mock
VITE_ENABLE_MOCK=true
VITE_BASE_URL=http://localhost:5173
#VITE_ENABLE_MOCK=true
#VITE_BASE_URL=http://localhost:5173
# local
#VITE_ENABLE_MOCK=false
#VITE_BASE_URL=http://localhost:8080
VITE_ENABLE_MOCK=false
VITE_BASE_URL=http://localhost:8080
# dev
#VITE_ENABLE_MOCK=false
#VITE_BASE_URL=https://localhost/api