1.2.1更新resps

This commit is contained in:
2018-11-09 15:05:26 +08:00
parent e00164f85b
commit 286c65b868
3 changed files with 26 additions and 4 deletions

View File

@@ -59,18 +59,18 @@ public class Resps<T> implements Serializable {
}
public Resps<T> setSucc(T t) {
setSucc(t, RespsConsts.MSG_SUCCESS_OPERATE);
this.data = t;
return this;
}
public Resps<T> setSucc(T t, String msg) {
setSucc(t, new String[]{msg});
this.setMsg(new String[]{msg});
this.setData(t);
return this;
}
public Resps<T> setSucc(T t, String[] msg) {
this.setData(t);
this.setCode(RespsConsts.CODE_SUCCESS);
this.setMsg(msg);
return this;
}
@@ -81,6 +81,14 @@ public class Resps<T> implements Serializable {
return this;
}
public static Resps success(String code, String msg) {
return new Resps(code, msg);
}
public static Resps success(String code, String[] msg) {
return new Resps(code, msg);
}
public static Resps success(String[] msg) {
return new Resps(RespsConsts.CODE_SUCCESS, msg);
}
@@ -93,6 +101,10 @@ public class Resps<T> implements Serializable {
return new Resps(RespsConsts.CODE_SUCCESS, RespsConsts.MSG_SUCCESS_OPERATE);
}
public static Resps error() {
return new Resps(RespsConsts.CODE_ERROR, RespsConsts.MSG_ERROT_OPERATE);
}
public static Resps error(String msg) {
return new Resps(RespsConsts.CODE_ERROR, msg);
}
@@ -109,6 +121,10 @@ public class Resps<T> implements Serializable {
return new Resps(code, msg);
}
public static Resps fail() {
return new Resps(RespsConsts.CODE_FAIL, RespsConsts.MSG_FAIL_OPERATE);
}
public static Resps fail(String msg) {
return new Resps(RespsConsts.CODE_FAIL, msg);
}