com.envisioniot.enos.api.common.constant.response.EnosPageRsp Maven / Gradle / Ivy
package com.envisioniot.enos.api.common.constant.response;
import com.envisioniot.enos.api.common.constant.request.Sorter;
import java.util.List;
/**
* 常规负责基础返回信息,主要用于Rpc的返回 这个可以是返回单个对象
*
* @author : gaozhijun
* @date : 2019-04-30 15:53
**/
public class EnosPageRsp extends AbstractEnosRsp> {
/**
*
*/
private static final long serialVersionUID = -5066102065382202993L;
public EnosPageRsp() {}
public static EnosPageRsp.Builder builder() {
return new EnosPageRsp.Builder<>();
}
@Override
public String toString() {
return "EnosPageRsp(super=" + super.toString() + ")";
}
public static class Builder extends AbstractEnosRsp.AbstractBuilder> {
public Builder() {}
public EnosPageRsp.Builder wrapSuccessByPage(List list, int pageSize, int pageNo, int totalRecord,
List sorted) {
super.data(EnosPageData.builder().pageSize(pageSize).pageNo(pageNo).totalRecord(totalRecord)
.sortedBy(sorted).items(list).build()).msg(DEFAULT_SUCCESS_MSG).code(0);
return this;
}
@Override
@SuppressWarnings("unchecked")
protected EnosPageRsp createRspInstance() {
return new EnosPageRsp<>();
}
}
}