content: package com.gpmall.commons.result;
  
  /**
   * 腾讯课堂搜索【咕泡学院】
   * 官网：www.gupaoedu.com
   * 风骚的Mic 老师
   * create-date: 2019/7/22-18:45
   */
  public class ResponseUtil<T> {
  
      private ResponseData<T> responseData;
  
      public ResponseUtil() {
          responseData = new ResponseData<>();
          responseData.setSuccess(true);
          responseData.setMessage("success");
          responseData.setCode(200);
      }
  
      public ResponseData<T> setData(T t) {
          this.responseData.setResult(t);
          this.responseData.setSuccess(true);
          responseData.setCode(200);
          return this.responseData;
      }
  
      public ResponseData<T> setData(T t, String msg) {
          this.responseData.setResult(t);
          this.responseData.setSuccess(true);
          this.responseData.setMessage(msg);
          responseData.setCode(200);
          return this.responseData;
      }
  
      public ResponseData<T> setErrorMsg(String msg) {
          this.responseData.setSuccess(false);
          this.responseData.setMessage(msg);
          responseData.setCode(500);
          return this.responseData;
      }
  
      public ResponseData<T> setErrorMsg(Integer code, String msg) {
          this.responseData.setSuccess(false);
          this.responseData.setMessage(msg);
          responseData.setCode(500);
          return this.responseData;
      }
  }
  