You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
620 B
34 lines
620 B
package com.teaching.backend.common; |
|
|
|
import lombok.Data; |
|
|
|
import java.io.Serializable; |
|
|
|
/** |
|
* 通用返回类 |
|
* |
|
* @param <T> |
|
*/ |
|
@Data |
|
public class BaseResponse<T> implements Serializable { |
|
|
|
private int code; |
|
|
|
private T data; |
|
|
|
private String message; |
|
|
|
public BaseResponse(int code, T data, String message) { |
|
this.code = code; |
|
this.data = data; |
|
this.message = message; |
|
} |
|
|
|
public BaseResponse(int code, T data) { |
|
this(code, data, ""); |
|
} |
|
|
|
public BaseResponse(ErrorCode errorCode) { |
|
this(errorCode.getCode(), null, errorCode.getMessage()); |
|
} |
|
}
|
|
|