mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
refactor: 重构请求/响应数据封装类
This commit is contained in:
parent
e948e422b0
commit
a372a09b18
@ -3,14 +3,13 @@ package io.github.xxyopen.novel.core.common.req;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页请求数据格式封装,所有分页请求的 DTO 应继承该类
|
* 分页请求数据格式封装,所有分页请求的Dto类都应继承该类
|
||||||
*
|
*
|
||||||
* @author xiongxiaoyang
|
* @author xiongxiaoyang
|
||||||
* @date 2022/5/11
|
* @date 2022/5/11
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class PageReq {
|
public class PageReqDto {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求页码,默认第 1 页
|
* 请求页码,默认第 1 页
|
@ -5,13 +5,13 @@ import lombok.Getter;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页数据格式封装
|
* 分页响应数据格式封装
|
||||||
*
|
*
|
||||||
* @author xiongxiaoyang
|
* @author xiongxiaoyang
|
||||||
* @date 2022/5/11
|
* @date 2022/5/11
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class PageBean<T> {
|
public class PageRespDto<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页码
|
* 页码
|
||||||
@ -37,15 +37,15 @@ public class PageBean<T> {
|
|||||||
* 该构造函数用于通用分页查询的场景
|
* 该构造函数用于通用分页查询的场景
|
||||||
* 接收普通分页数据和普通集合
|
* 接收普通分页数据和普通集合
|
||||||
*/
|
*/
|
||||||
public PageBean(long pageNum, long pageSize, long total, List<T> list) {
|
public PageRespDto(long pageNum, long pageSize, long total, List<T> list) {
|
||||||
this.pageNum = pageNum;
|
this.pageNum = pageNum;
|
||||||
this.pageSize = pageSize;
|
this.pageSize = pageSize;
|
||||||
this.total = total;
|
this.total = total;
|
||||||
this.list = list;
|
this.list = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> PageBean<T> of(long pageNum, long pageSize, long total, List<T> list) {
|
public static <T> PageRespDto<T> of(long pageNum, long pageSize, long total, List<T> list) {
|
||||||
return new PageBean<>(pageNum, pageSize, total, list);
|
return new PageRespDto<>(pageNum, pageSize, total, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
Loading…
x
Reference in New Issue
Block a user