refactor: extract common DTOs to manage-common

This commit is contained in:
张翔
2026-03-13 12:59:26 +08:00
parent e6b64a733a
commit 9364b966c9
2 changed files with 2 additions and 2 deletions
@@ -0,0 +1,49 @@
package cn.novalon.manage.common.dto;
public class PageRequest {
private int page = 0;
private int size = 10;
private String sort = "id";
private String order = "asc";
private String keyword;
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
}
@@ -0,0 +1,82 @@
package cn.novalon.manage.common.dto;
import java.util.List;
public class PageResponse<T> {
private List<T> content;
private int totalPages;
private long totalElements;
private int currentPage;
private int pageSize;
private boolean first;
private boolean last;
public PageResponse() {
}
public PageResponse(List<T> content, int totalPages, long totalElements, int currentPage, int pageSize) {
this.content = content;
this.totalPages = totalPages;
this.totalElements = totalElements;
this.currentPage = currentPage;
this.pageSize = pageSize;
this.first = currentPage == 0;
this.last = currentPage >= totalPages - 1;
}
public List<T> getContent() {
return content;
}
public void setContent(List<T> content) {
this.content = content;
}
public int getTotalPages() {
return totalPages;
}
public void setTotalPages(int totalPages) {
this.totalPages = totalPages;
}
public long getTotalElements() {
return totalElements;
}
public void setTotalElements(long totalElements) {
this.totalElements = totalElements;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public boolean isFirst() {
return first;
}
public void setFirst(boolean first) {
this.first = first;
}
public boolean isLast() {
return last;
}
public void setLast(boolean last) {
this.last = last;
}
}