You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
862 B
43 lines
862 B
package com.iflytop.handacid.common.result;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import lombok.Data;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 分页响应结构体
|
|
*/
|
|
@Data
|
|
public class PageResult<T> implements Serializable {
|
|
|
|
private String code;
|
|
|
|
private Data<T> data;
|
|
|
|
private String msg;
|
|
|
|
public static <T> PageResult<T> success(IPage<T> page) {
|
|
PageResult<T> result = new PageResult<>();
|
|
result.setCode(ResultCode.SUCCESS.getCode());
|
|
|
|
Data<T> data = new Data<>();
|
|
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;
|
|
|
|
}
|
|
|
|
}
|