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.

23 lines
583 B

  1. package com.deepchart.utils;
  2. import lombok.AllArgsConstructor;
  3. import lombok.Data;
  4. /**
  5. * 请求响应返回结果工具类
  6. * @param <T>
  7. */
  8. @Data
  9. @AllArgsConstructor
  10. public class Result<T> {
  11. private Integer code; //状态码
  12. private String msg; //返回信息
  13. private T data; //返回数据
  14. public static <T> Result<T> success(String message, T data) {
  15. return new Result<>(200, message, data);
  16. }
  17. public static <T> Result<T> error(Integer resultCode, String message) {
  18. return new Result<>(resultCode, message, null);
  19. }
  20. }