1.2.1更新resps

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

View File

@ -1,6 +1,12 @@
yexuejc-base 更新记录
------------------
#### version 1.2.1
**time2018-11-9 15:05:06** <br/>
**branch** master <br/>
**update** <br/>
>1. 优化resps
#
#### version 1.2.0
**time2018-10-19 11:38:20** <br/>
**branch** master <br/>

View File

@ -6,7 +6,7 @@
<groupId>com.yexuejc.base</groupId>
<artifactId>yexuejc-base</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<name>${project.artifactId}</name>

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);
}