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.
24 lines
583 B
24 lines
583 B
package com.deepchart.utils;
|
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.Data;
|
|
|
|
/**
|
|
* 请求响应返回结果工具类
|
|
* @param <T>
|
|
*/
|
|
@Data
|
|
@AllArgsConstructor
|
|
public class Result<T> {
|
|
private Integer code; //状态码
|
|
private String msg; //返回信息
|
|
private T data; //返回数据
|
|
|
|
public static <T> Result<T> success(String message, T data) {
|
|
return new Result<>(200, message, data);
|
|
}
|
|
|
|
public static <T> Result<T> error(Integer resultCode, String message) {
|
|
return new Result<>(resultCode, message, null);
|
|
}
|
|
}
|