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