Helius
2021-09-16 4d80b819948366cb0754369b1bea5e0e83cf6af1
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
39
40
41
42
43
44
package cc.mrbird.febs.common.entity;
 
import org.springframework.http.HttpStatus;
 
import java.util.HashMap;
 
/**
 * @author MrBird
 */
public class FebsResponse extends HashMap<String, Object> {
 
    private static final long serialVersionUID = -8713837118340960775L;
 
    public FebsResponse code(HttpStatus status) {
        this.put("code", status.value());
        return this;
    }
 
    public FebsResponse message(String message) {
        this.put("message", message);
        return this;
    }
 
    public FebsResponse data(Object data) {
        this.put("data", data);
        return this;
    }
 
    public FebsResponse success() {
        this.code(HttpStatus.OK);
        return this;
    }
 
    public FebsResponse fail() {
        this.code(HttpStatus.INTERNAL_SERVER_ERROR);
        return this;
    }
 
    @Override
    public FebsResponse put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}