8 changed files with 184 additions and 1 deletions
@ -0,0 +1,19 @@ |
|||
package com.youlai.boot.mini.model.query; |
|||
|
|||
import com.youlai.boot.common.base.BaseQuery; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.Max; |
|||
import jakarta.validation.constraints.Min; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
@Schema(description = "瀑布流查询参数") |
|||
public class WaterfallQuery extends BaseQuery { |
|||
|
|||
@Schema(description = "游标(上一页最后一条的ID,首次请求不传)", example = "100") |
|||
private Long cursor; |
|||
|
|||
@Schema(description = "动物类型筛选(cat-猫 dog-狗 other-其他)", example = "cat") |
|||
private String animalType; |
|||
|
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
package com.youlai.boot.mini.model.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@Schema(description = "瀑布流返回结果") |
|||
public class WaterfallResult<T> { |
|||
|
|||
@Schema(description = "数据列表") |
|||
private List<T> list; |
|||
|
|||
@Schema(description = "下一页游标(传null表示没有更多了)", example = "100") |
|||
private Long nextCursor; |
|||
|
|||
@Schema(description = "是否最后一页", example = "false") |
|||
private Boolean isLastPage; |
|||
|
|||
public static <T> WaterfallResult<T> of(List<T> list, Long nextCursor, boolean isLastPage) { |
|||
WaterfallResult<T> result = new WaterfallResult<>(); |
|||
result.setList(list); |
|||
result.setNextCursor(nextCursor); |
|||
result.setIsLastPage(isLastPage); |
|||
return result; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue