北京经济技术开发区经开区虚拟城市项目-【后端】-服务,Poi,企业,地块等定制接口
AdaKing88
2023-07-26 1651fb641f0eb793002d00ec51edf1af73376f81
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
45
46
47
package com.smartearth.poiexcel.utils;
 
import org.apache.http.HttpStatus;
import java.util.HashMap;
import java.util.Map;
 
public class Result extends HashMap<String, Object> {
 
    private final static int CODE_SUCCESS=0;
 
    public static Result error() {
        return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员");
    }
 
    public static Result error(String msg) {
        return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg);
    }
 
    public static Result error(int code, String msg) {
        Result r = new Result();
        r.put("code", code);
        r.put("msg", msg);
        return r;
    }
 
    public static Result ok() {
        return ok("操作成功");
    }
 
    public static Result ok(String msg) {
        Result r = new Result();
        r.put("code", CODE_SUCCESS);
        r.put("msg", msg);
        return r;
    }
 
    public Result put(Map<String, Object> map) {
        super.putAll(map);
        return this;
    }
 
    public Result put(String key, Object value) {
        super.put(key, value);
        return this;
    }
 
}