新增分页对象,是doc文档返回对应的文档注释
This commit is contained in:
37
yshop-common/src/main/java/co/yixiang/domain/PageResult.java
Normal file
37
yshop-common/src/main/java/co/yixiang/domain/PageResult.java
Normal file
@ -0,0 +1,37 @@
|
||||
package co.yixiang.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author :LionCity
|
||||
* @date :Created in 2020-08-04 16:55
|
||||
* @description:分页参数返回
|
||||
* @modified By:
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
public class PageResult<T> implements Serializable {
|
||||
|
||||
|
||||
@ApiModelProperty("总数量")
|
||||
private long totalElements;
|
||||
|
||||
@ApiModelProperty("内容")
|
||||
private List<T> content;
|
||||
|
||||
public PageResult(long totalElements, List<T> content) {
|
||||
this.totalElements = totalElements;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public PageResult() {
|
||||
}
|
||||
}
|
@ -6,6 +6,8 @@
|
||||
package co.yixiang.dozer.service;
|
||||
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.domain.PageResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.dozer.Mapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@ -65,4 +67,9 @@ public class EJBGenerator implements IGenerator {
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, S> PageResult<T> convertPageInfo(PageInfo<S> s, Class<T> clz) {
|
||||
return new PageResult(s.getTotal(), convert(s.getList(), clz));
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
package co.yixiang.dozer.service;
|
||||
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.domain.PageResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -80,4 +82,10 @@ public interface IGenerator {
|
||||
* @Time 2018年5月9日 下午3:54:57
|
||||
*/
|
||||
<T, S> T[] convert(S[] s, Class<T> clz);
|
||||
|
||||
/**
|
||||
* 分页信息转换
|
||||
* @return {@link PageResult<T>}
|
||||
*/
|
||||
<T, S> PageResult<T> convertPageInfo(PageInfo<S> s, Class<T> clz);
|
||||
}
|
||||
|
Reference in New Issue
Block a user