-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathR.java
More file actions
38 lines (27 loc) · 746 Bytes
/
R.java
File metadata and controls
38 lines (27 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.springboot_rt.entity;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Data
public class R {
private Boolean flag; //编码:true成功,flase为失败
private String msg; //错误信息
private Object data; //数据
private Map map = new HashMap(); //动态数据
public static R success(Object object) {
R r = new R();
r.data = object;
r.flag = true;
return r;
}
public static R error(String msg) {
R r = new R();
r.msg = msg;
r.flag = false;
return r;
}
public R add(String key, Object value) {
this.map.put(key, value);
return this;
}
}