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() { public List<SortField<Object>> getSortFields() {
return sortBy.entrySet().stream() List<SortField<Object>> sortFields = sortBy.entrySet().stream()
.map( .map(
(entry) -> (entry) ->
field(name(entry.getKey())).sort(SortOrder.valueOf(entry.getValue().getKeyword()))) field(name(entry.getKey())).sort(SortOrder.valueOf(entry.getValue().getKeyword())))
.toList(); .toList();
if (sortFields.isEmpty()) {
return List.of(field(name("id")).sort(SortOrder.ASC));
} else {
return sortFields;
}
} }
private void checkPageAndSize(int page, int size) { private void checkPageAndSize(int page, int size) {

View File

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

View File

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