| package com.xzx.gc.common; | 
|   | 
| import io.swagger.annotations.ApiModelProperty; | 
|   | 
| /** | 
|  * @author:andylei | 
|  * @title | 
|  * @Description | 
|  * @date 2018/11/22/022 | 
|  * @修改历史 | 
|  */ | 
| public class Result<T> { | 
|     @ApiModelProperty("返回消息") | 
|     private String msg="success"; | 
|   | 
|     @ApiModelProperty("返回标识码") | 
|     private Integer code=0; | 
|   | 
|     @ApiModelProperty("返回对象") | 
|     private T data; | 
|   | 
|   | 
|   | 
|   | 
|     public String getMsg() { | 
|         return msg; | 
|     } | 
|   | 
|     public void setMsg(String msg) { | 
|         this.msg = msg; | 
|     } | 
|   | 
|     public Integer getCode() { | 
|         return code; | 
|     } | 
|   | 
|     public void setCode(Integer code) { | 
|         this.code = code; | 
|     } | 
|   | 
|     public T getData() { | 
|         return data; | 
|     } | 
|   | 
|     public void setData(T data) { | 
|         this.data = data; | 
|     } | 
|   | 
|     public Result() { | 
|     } | 
|   | 
|     public Result(String msg) { | 
|         this.msg = msg; | 
|     } | 
|   | 
|     public static<T> Result<T> error(String msg){ | 
|         Result<T> result = new Result<T>(); | 
|         result.setMsg(msg); | 
|         result.setCode(-1); | 
|         return result; | 
|     } | 
|   | 
|     public static<T> Result<T> create(){ | 
|         return new Result<>(); | 
|     } | 
|   | 
|     public static<T> Result<T> success(T data){ | 
|         Result<T> result = new Result<T>(); | 
|         result.setMsg("success"); | 
|         result.setCode(0); | 
|         result.setData(data); | 
|         return result; | 
|     } | 
|   | 
|     public static<T> Result<T> success(){ | 
|         Result<T> result = new Result<T>(); | 
|         result.setMsg("success"); | 
|         result.setCode(0); | 
|         result.setData(null); | 
|         return result; | 
|     } | 
|   | 
|     public static<T> Result<T> error(Integer code,String msg){ | 
|        Result<T> result=new Result<>(); | 
|        result.setCode(code); | 
|        result.setMsg(msg); | 
|        return result; | 
|     } | 
|   | 
| } |