mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-20 01:13:46 +08:00
init
This commit is contained in:
22
backend/src/main/java/com/zl/mjga/dto/PageResponseDto.java
Normal file
22
backend/src/main/java/com/zl/mjga/dto/PageResponseDto.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.zl.mjga.dto;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.*;
|
||||
|
||||
@Data
|
||||
public class PageResponseDto<T> {
|
||||
private long total;
|
||||
private T data;
|
||||
|
||||
public PageResponseDto(long total, @Nullable T data) {
|
||||
if (total < 0) {
|
||||
throw new IllegalArgumentException("total must not be less than zero");
|
||||
}
|
||||
this.total = total;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> PageResponseDto<T> empty() {
|
||||
return new PageResponseDto<>(0, null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user