mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2025-01-04 01:52:21 +08:00
refactor(PageResult.java): 分页的总条数调整至data的total属性,数据列表移动至data的list属性。
This commit is contained in:
parent
2a7351d69f
commit
3815fa7946
@ -17,18 +17,30 @@ public class PageResult<T> implements Serializable {
|
||||
|
||||
private String code;
|
||||
|
||||
private List<T> data;
|
||||
|
||||
private long total;
|
||||
private Data data;
|
||||
|
||||
private String msg;
|
||||
|
||||
public static <T> PageResult<T> success(IPage<T> page) {
|
||||
PageResult<T> result = new PageResult<>();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setData(page.getRecords());
|
||||
result.setTotal(page.getTotal());
|
||||
|
||||
Data data = new Data<T>();
|
||||
data.setList(page.getRecords());
|
||||
data.setTotal(page.getTotal());
|
||||
|
||||
result.setData(data);
|
||||
result.setMsg(ResultCode.SUCCESS.getMsg());
|
||||
return result;
|
||||
}
|
||||
|
||||
@lombok.Data
|
||||
public static class Data<T> {
|
||||
|
||||
private List<T> list;
|
||||
|
||||
private long total;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user