You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
815 B
Java
40 lines
815 B
Java
package com.jiashi;
|
|
|
|
import lombok.Data;
|
|
|
|
/**
|
|
* @ClassName CommonResult
|
|
* @Description
|
|
* @Author linjj
|
|
* @Date 2024/5/7 10:51
|
|
* @Version 1.0
|
|
*/
|
|
@Data
|
|
public class CommonResult<T> {
|
|
|
|
|
|
private Integer code;
|
|
|
|
private String msgCode;
|
|
|
|
private String msg;
|
|
|
|
private T data;
|
|
|
|
public static <T> CommonResult<T> success(T data){
|
|
CommonResult commonResult = new CommonResult();
|
|
commonResult.setCode(0);
|
|
commonResult.setMsg("操作成功");
|
|
commonResult.setData(data);
|
|
return commonResult;
|
|
}
|
|
|
|
public static <T> CommonResult<T> failed(T data){
|
|
CommonResult commonResult = new CommonResult();
|
|
commonResult.setCode(500);
|
|
commonResult.setMsg("操作失败");
|
|
commonResult.setData(data);
|
|
return commonResult;
|
|
}
|
|
}
|