CommonResult.java 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.persagy.fm.common.response;
  2. import com.fasterxml.jackson.annotation.JsonInclude;
  3. import com.persagy.common.enums.ResponseCode;
  4. import lombok.Data;
  5. /**
  6. * 服务调用消息结果
  7. * @author Charlie Yu
  8. * @date 2021-03-25
  9. */
  10. @Data
  11. @JsonInclude(JsonInclude.Include.NON_NULL)
  12. public class CommonResult<T> {
  13. /** 不需要提示 */
  14. public static final CommonResult SUCCESS = new CommonResult();
  15. /** 响应码 */
  16. private String respCode;
  17. /** 响应码 */
  18. private String respMsg;
  19. /** 响应数据 */
  20. private T content;
  21. /**
  22. * 构造方法
  23. */
  24. public CommonResult(){
  25. this(ResponseCode.A00000.getCode(), ResponseCode.A00000.getDesc());
  26. }
  27. /**
  28. * 构造方法
  29. * @param respCode 响应码
  30. * @param respMsg 提示信息
  31. */
  32. public CommonResult(String respCode, String respMsg) {
  33. this(respCode, respMsg,null);
  34. }
  35. /**
  36. * 构造方法
  37. * @param respCode 响应码
  38. * @param respMsg 提示信息
  39. * @param content 数据
  40. */
  41. public CommonResult(String respCode, String respMsg, T content){
  42. this.respCode = respCode;
  43. this.respMsg = respMsg;
  44. this.content = content;
  45. }
  46. }