解决消息分页问题
This commit is contained in:
@ -13,11 +13,17 @@ public class PageDTO {
|
||||
|
||||
@ApiModelProperty(required = false, value = "当前页(默认1)")
|
||||
private int current;
|
||||
|
||||
|
||||
@ApiModelProperty(required = false, value = "页码(默认1)")
|
||||
private int pageNo;
|
||||
|
||||
|
||||
@ApiModelProperty(required = false, value = "单页数量(默认15)")
|
||||
private int pageSize;
|
||||
|
||||
public PageDTO() {
|
||||
this.current = 1;
|
||||
this.pageNo = 1;
|
||||
this.pageSize = 15;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -69,14 +69,13 @@ public class BizMessageConsumerServiceImpl implements BizMessageConsumerService
|
||||
* @return
|
||||
*/
|
||||
private PageDTO createPageCondition(PageDTO page) {
|
||||
page = Optional.ofNullable(page).map(p -> {
|
||||
return Optional.ofNullable(page).map(p -> {
|
||||
p.setCurrent(Math.max(1, p.getCurrent()));
|
||||
p.setPageNo(Math.max(1, p.getPageNo()));
|
||||
p.setPageSize(p.getPageSize() == 0 ? 15 : p.getPageSize());
|
||||
|
||||
return p;
|
||||
}).orElseGet(PageDTO::new);
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user