zouyu
9 天以前 bf95078dab81dcd0639fdb1a41e998b31c940fb1
src/main/java/com/chinaztt/mes/docx/util/Result.java
ÎļþÃû´Ó src/main/java/com/chinaztt/mes/docx/util/R.java ÐÞ¸Ä
@@ -9,7 +9,11 @@
import java.io.Serializable;
public class R<T> implements Serializable {
/**
 * é€šç”¨è¿”回对象
 * @param <T>
 */
public class Result<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    // "返回标记:成功标记=0,失败标记=1"
    private int code;
@@ -18,36 +22,36 @@
    // "数据"
    private T data;
    public static <T> R<T> ok() {
    public static <T> Result<T> ok() {
        return restResult(null, CommonConstants.SUCCESS, (String) null);
    }
    public static <T> R<T> ok(T data) {
    public static <T> Result<T> ok(T data) {
        return restResult(data, CommonConstants.SUCCESS, (String) null);
    }
    public static <T> R<T> ok(T data, String msg) {
    public static <T> Result<T> ok(T data, String msg) {
        return restResult(data, CommonConstants.SUCCESS, msg);
    }
    public static <T> R<T> failed() {
    public static <T> Result<T> failed() {
        return restResult(null, CommonConstants.FAIL, (String) null);
    }
    public static <T> R<T> failed(String msg) {
    public static <T> Result<T> failed(String msg) {
        return restResult(null, CommonConstants.FAIL, msg);
    }
    public static <T> R<T> failed(T data) {
    public static <T> Result<T> failed(T data) {
        return restResult(data, CommonConstants.FAIL, (String) null);
    }
    public static <T> R<T> failed(T data, String msg) {
    public static <T> Result<T> failed(T data, String msg) {
        return restResult(data, CommonConstants.FAIL, msg);
    }
    private static <T> R<T> restResult(T data, int code, String msg) {
        R<T> apiResult = new R();
    private static <T> Result<T> restResult(T data, int code, String msg) {
        Result<T> apiResult = new Result();
        apiResult.setCode(code);
        apiResult.setData(data);
        apiResult.setMsg(msg);
@@ -62,10 +66,10 @@
        return "R(code=" + this.getCode() + ", msg=" + this.getMsg() + ", data=" + this.getData() + ")";
    }
    public R() {
    public Result() {
    }
    public R(int code, String msg, T data) {
    public Result(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
@@ -75,7 +79,7 @@
        return this.code;
    }
    public R<T> setCode(int code) {
    public Result<T> setCode(int code) {
        this.code = code;
        return this;
    }
@@ -84,7 +88,7 @@
        return this.msg;
    }
    public R<T> setMsg(String msg) {
    public Result<T> setMsg(String msg) {
        this.msg = msg;
        return this;
    }
@@ -93,7 +97,7 @@
        return this.data;
    }
    public R<T> setData(T data) {
    public Result<T> setData(T data) {
        this.data = data;
        return this;
    }
@@ -121,8 +125,8 @@
            return this;
        }
        public R<T> build() {
            return new R(this.code, this.msg, this.data);
        public Result<T> build() {
            return new Result(this.code, this.msg, this.data);
        }
        public String toString() {