package cn.fiona.pet.account.facade;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiResponse;

import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;

/**
 * DTO to customize the returned message
 *
 * @author lishen
 */
@XmlRootElement
@ApiModel("返回结果")
public class RestResult<T> implements Serializable {
    public static final int OK = 0;
    public static final String M_OK = "成功";

    public static RestResult OK(Object data){
        RestResult restResult = new RestResult();
        restResult.setErrorMessage(M_OK);
        restResult.setErrorCode(OK);
        restResult.setData(data);
        return restResult;
    }

    @ApiModelProperty("错误码:0 无错误信息;404 未找到资源 500 服务器错误")
    private int errorCode;
    @ApiModelProperty("错误信息")
    private String errorMessage;
    @ApiModelProperty("数据信息")
    private T data;

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}

@@ -598,21 +598,16 @@
 sult.set
-Error
 Message(
@@ -635,21 +635,16 @@
 sult.set
-Error
 Code(OK)
@@ -757,16 +757,17 @@
 04 %E6%9C%AA%E6%89%BE%E5%88%B0%E8%B5%84%E6%BA%90
+;
  500 %E6%9C%8D%E5%8A%A1%E5%99%A8
@@ -768,16 +768,17 @@
 00 %E6%9C%8D%E5%8A%A1%E5%99%A8%E9%94%99%E8%AF%AF
+;
 %22)%0A    p
@@ -788,22 +788,17 @@
 ate int 
-errorC
+c
 ode;%0A   
@@ -839,30 +839,25 @@
 vate String 
-errorM
+m
 essage;%0A    
@@ -921,21 +921,16 @@
  int get
-Error
 Code() %7B
@@ -945,22 +945,17 @@
  return 
-errorC
+c
 ode;%0A   
@@ -977,21 +977,16 @@
 void set
-Error
 Code(int
@@ -986,22 +986,17 @@
 ode(int 
-errorC
+c
 ode) %7B%0A 
@@ -1011,26 +1011,16 @@
 his.
-errorCode = errorC
+code = c
 ode;
@@ -1048,21 +1048,16 @@
 ring get
-Error
 Message(
@@ -1075,22 +1075,17 @@
  return 
-errorM
+m
 essage;%0A
@@ -1114,13 +1114,8 @@
  set
-Error
 Mess
@@ -1125,22 +1125,17 @@
 (String 
-errorM
+m
 essage) 
@@ -1149,22 +1149,17 @@
    this.
-errorM
+m
 essage =
@@ -1163,14 +1163,9 @@
 e = 
-errorM
+m
 essa

modify result