2
zyy
2025-11-14 6e85d12eab8accba3dd6731d9273388bd7f8d68c
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
48
/**
 * Copyright &copy; 2021-2026 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.yami.trading.common.util;
 
import org.springframework.http.ResponseEntity;
 
import java.io.Serializable;
import java.util.HashMap;
 
 
/**
 * 返回包装wrapper
 * @author
 *
 */
public class ResponseUtil extends HashMap<String,Object> implements Serializable {
 
    public static ResponseUtil newInstance() {
        ResponseUtil fragment = new ResponseUtil ();
        return fragment;
    }
 
    public ResponseUtil add (String key, Object value) {
        super.put(key, value);
        return this;
    }
 
    public ResponseEntity ok() {
        return ResponseEntity.ok (this);
    }
 
    public ResponseEntity error() {
        return ResponseEntity.badRequest ().body (this);
    }
 
    public ResponseEntity ok(String msg) {
        this.put ("msg", msg);
        return ResponseEntity.ok (this);
    }
 
    public ResponseEntity error(String msg) {
        this.put ("msg", msg);
        return ResponseEntity.badRequest ().body (this);
    }
 
 
}