@Data
@AllArgsConstructor
@NoArgsConstructor
public class CommonResult<T>{
private Integer code;
private String message;
private T data;
public static CommonResult success(){
CommonResult result=new CommonResult();
result.setCode(200);
result.setMessage("成功");
return result;
}
public static <T> CommonResult<T> success(T data){
CommonResult<T> result=new CommonResult<T>();
result.setData(data);
result.setCode(200);
result.setMessage("成功");
return result;
}
public static CommonResult error(Integer code,String msg){
CommonResult result=new CommonResult();
result.setCode(code);
result.setMessage(msg);
return result;
}
}
CommonResult类(公共返回类)
最新推荐文章于 2023-07-07 15:56:20 发布