class R extends HashMap<String, Object> {
    private static final long serialVersionUID = 1L;

    public R setData(Object data) {
        put("data", data);
        return this;
    }

    //利用fastjson进行逆转
    public <T> T getData(String key, TypeReference<T> typeReference) {
        Object data = get(key);//默认是map
        String s = JSON.toJSONString(data);
        T t = JSON.parseObject(s, typeReference);
        return t;
    }

    //利用fastjson进行逆转
    public <T> T getData(TypeReference<T> typeReference) {
        Object data = get("data");
        String s = JSON.toJSONString(data);
        T t = JSON.parseObject(s, typeReference);
        return t;
    }


    public R() {
        put("code", 200);
        put("msg", "success");
    }

    public static R error() {
        return error(500, "未知异常，请联系管理员");
    }

    public static R error(String msg) {
        return error(500, msg);
    }

    public static R error(int code, String msg) {<FILL_FUNCTION_BODY>}

    public static R error(BizCodeEnum bizCodeEnum) {
        R r = new R();
        r.put("code", bizCodeEnum.getCode());
        r.put("msg", bizCodeEnum.getMsg());
        return r;
    }

    public static R ok(String msg) {
        R r = new R();
        r.put("msg", msg);
        return r;
    }

    public static R ok(Object data) {
        R r = new R();
        r.put("data", data);
        return r;
    }

    public static R ok(Map<String, Object> map) {
        R r = new R();
        r.putAll(map);
        return r;
    }

    public static R ok() {
        return new R();
    }

    public R put(String key, Object value) {
        super.put(key, value);
        return this;
    }

    public R put(Object value) {
        super.put("data", value);
        return this;
    }

    public R put(PageResult pageResult) {
        super.put("rows", pageResult.getRows());
        super.put("total", pageResult.getTotal());
        return this;
    }

    public R put(IPage page) {
        super.put("rows", page.getRecords());
        super.put("total", page.getTotal());
        return this;
    }


    public Integer getCode() {
        return (Integer) this.get("code");
    }
}

        R r = new R();
        r.put("code", code);
        r.put("msg", msg);
        return r;
    
<methods>public void <init>() ,public void <init>(int) ,public void <init>(Map<? extends java.lang.String,? extends java.lang.Object>) ,public void <init>(int, float) ,public void clear() ,public java.lang.Object clone() ,public java.lang.Object compute(java.lang.String, BiFunction<? super java.lang.String,? super java.lang.Object,? extends java.lang.Object>) ,public java.lang.Object computeIfAbsent(java.lang.String, Function<? super java.lang.String,? extends java.lang.Object>) ,public java.lang.Object computeIfPresent(java.lang.String, BiFunction<? super java.lang.String,? super java.lang.Object,? extends java.lang.Object>) ,public boolean containsKey(java.lang.Object) ,public boolean containsValue(java.lang.Object) ,public Set<Entry<java.lang.String,java.lang.Object>> entrySet() ,public void forEach(BiConsumer<? super java.lang.String,? super java.lang.Object>) ,public java.lang.Object get(java.lang.Object) ,public java.lang.Object getOrDefault(java.lang.Object, java.lang.Object) ,public boolean isEmpty() ,public Set<java.lang.String> keySet() ,public java.lang.Object merge(java.lang.String, java.lang.Object, BiFunction<? super java.lang.Object,? super java.lang.Object,? extends java.lang.Object>) ,public java.lang.Object put(java.lang.String, java.lang.Object) ,public void putAll(Map<? extends java.lang.String,? extends java.lang.Object>) ,public java.lang.Object putIfAbsent(java.lang.String, java.lang.Object) ,public java.lang.Object remove(java.lang.Object) ,public boolean remove(java.lang.Object, java.lang.Object) ,public java.lang.Object replace(java.lang.String, java.lang.Object) ,public boolean replace(java.lang.String, java.lang.Object, java.lang.Object) ,public void replaceAll(BiFunction<? super java.lang.String,? super java.lang.Object,? extends java.lang.Object>) ,public int size() ,public Collection<java.lang.Object> values() <variables>static final int DEFAULT_INITIAL_CAPACITY,static final float DEFAULT_LOAD_FACTOR,static final int MAXIMUM_CAPACITY,static final int MIN_TREEIFY_CAPACITY,static final int TREEIFY_THRESHOLD,static final int UNTREEIFY_THRESHOLD,transient Set<Entry<java.lang.String,java.lang.Object>> entrySet,final float loadFactor,transient int modCount,private static final long serialVersionUID,transient int size,transient Node<java.lang.String,java.lang.Object>[] table,int threshold