mirror of
https://github.com/RemainderTime/spring-boot-base-demo.git
synced 2026-06-04 00:47:46 +08:00
refactor(common): 移除通用响应类
- 删除了 GenericResponse 类及其所有构造方法 - 移除了与 ResponseCode 枚举的关联逻辑 - 清理了相关的泛型数据封装结构
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
package cn.xf.basedemo.common.exception;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: xiongfeng
|
||||
* @CreateTime: 2023-11-08 13:47
|
||||
* @Description: TODO
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class GenericResponse<T> {
|
||||
private int code;
|
||||
|
||||
private T data;
|
||||
|
||||
private String message;
|
||||
|
||||
public GenericResponse() {};
|
||||
|
||||
public GenericResponse(int code, T data) {
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public GenericResponse(int code, T data, String message) {
|
||||
this(code, data);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public GenericResponse(ResponseCode responseCode) {
|
||||
this.code = responseCode.getCode();
|
||||
this.data = null;
|
||||
this.message = responseCode.getMessage();
|
||||
}
|
||||
|
||||
public GenericResponse(ResponseCode responseCode, T data) {
|
||||
this(responseCode);
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public GenericResponse(ResponseCode responseCode, T data, String message) {
|
||||
this(responseCode, data);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user