Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/fxbin/bubble
Browse files Browse the repository at this point in the history
  • Loading branch information
fxbin committed Aug 24, 2023
2 parents 3074ac1 + 4b631ac commit f9703d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;

import java.io.Serializable;
import java.util.List;
import java.util.function.Function;

import static java.util.stream.Collectors.toList;

/**
* PageResult
Expand All @@ -13,6 +17,7 @@
* @version v1.0
* @since 2020/9/21 15:12
*/
@Getter
@ApiModel("分页结果")
public class PageResult<T> implements Serializable {

Expand All @@ -31,46 +36,26 @@ public class PageResult<T> implements Serializable {
@ApiModelProperty(value = "每页条数", required = true)
private Long pageSize;

public List<T> getList() {
return list;
}

public PageResult<T> setList(List<T> list) {
this.list = list;
return this;
}

public Long getTotal() {
return total;
}

public PageResult<T> setTotal(Long total) {
this.total = total;
return this;
}

public Long getTotalPage() {
return totalPage;
}

public PageResult<T> setTotalPage(Long totalPage) {
this.totalPage = totalPage;
return this;
}

public Long getPageNo() {
return pageNo;
}

public PageResult<T> setPageNo(Long pageNo) {
this.pageNo = pageNo;
return this;
}

public Long getPageSize() {
return pageSize;
}

public PageResult<T> setPageSize(Long pageSize) {
this.pageSize = pageSize;
return this;
Expand All @@ -97,4 +82,11 @@ public PageResult<T> compute(Long pageSize, Long pageNo, Long total) {
}
return this;
}

@SuppressWarnings("unchecked")
public <R> PageResult<R> convert(Function<? super T, ? extends R> mapper) {
List<R> collect = this.getList().stream().map(mapper).collect(toList());
return ((PageResult<R>)this).setList(collect);
}

}
1 change: 0 additions & 1 deletion bubble-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
<layers>
<enabled>true</enabled>
Expand Down

0 comments on commit f9703d3

Please sign in to comment.