mirror of https://github.com/halo-dev/halo
Create pageBy api for log.
parent
b2415d33ce
commit
574ae54208
|
@ -1,15 +1,21 @@
|
|||
package run.halo.app.controller.admin.api;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import run.halo.app.model.dto.LogDTO;
|
||||
import run.halo.app.model.entity.Log;
|
||||
import run.halo.app.service.LogService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.data.domain.Sort.Direction.DESC;
|
||||
|
||||
/**
|
||||
* Log controller.
|
||||
*
|
||||
|
@ -38,6 +44,12 @@ public class LogController {
|
|||
return logService.pageLatest(top).getContent();
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public Page<LogDTO> pageBy(@PageableDefault(sort = "updateTime", direction = DESC) Pageable pageable){
|
||||
Page<Log> logPage = logService.listAll(pageable);
|
||||
return logPage.map(log -> new LogDTO().convertFrom(log));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all logs.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue