mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
完善默认排序
This commit is contained in:
@@ -49,6 +49,7 @@ public class DataCollectorLogController {
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<DataCollectorLogDto> list(@RequestBody CommonQuery request) {
|
||||
|
||||
return this.service.list(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package cn.lihongjie.coal.dataCollectorLog.service;
|
||||
|
||||
import static org.springframework.data.domain.Sort.Order.asc;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
@@ -13,6 +17,7 @@ import cn.lihongjie.coal.dbFunctions.DbFunctionService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -67,7 +72,7 @@ public class DataCollectorLogService
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
Sort.by(CollectionUtils.isEmpty(query.getOrders()) ? singletonList(asc("createTime")) : query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user