chenjiahe
2021-10-27 baa873addcde42054ded866d79385712064b050b
提交 | 用户 | age
6c1bfc 1 package com.platform.resultTool;
C 2
3 import java.io.Serializable;
4
5 /**
6  * 开发平台统一返回格式
7  * @author chenjiahe
8  * @Data: 2021-10-20
9  */
10 public class PlatformResult implements Serializable {
11
12     private static final long serialVersionUID = -3948389268046368059L;
13
14     private String code;
15
16     private String msg;
17
18     private Object data;
19
20     public PlatformResult() {}
21
22     public PlatformResult(String code, String msg) {
23         this.code = code;
24         this.msg = msg;
25     }
26
27     public static PlatformResult success() {
28         PlatformResult Result = new PlatformResult();
29         Result.setCode(PlatformCode.SUCCESS);
30         Result.setMsg("SUCCESS");
31         return Result;
32     }
33
34     public static PlatformResult success(Object data) {
35         PlatformResult Result = new PlatformResult();
36         Result.setCode(PlatformCode.SUCCESS);
37         Result.setData(data);
38         Result.setMsg("SUCCESS");
39         return Result;
40     }
41
42     public static PlatformResult success(String code, String msg,Object data) {
43         PlatformResult Result = new PlatformResult();
44         Result.setCode(code);
45         Result.setData(data);
46         Result.setMsg(msg);
47         return Result;
48     }
49
50     public static PlatformResult failure(String code, String msg) {
51         PlatformResult Result = new PlatformResult();
52         Result.setCode(code);
53         Result.setMsg(msg);
54         return Result;
55     }
56
57     public static PlatformResult failure(String code, String msg, Object data) {
58         PlatformResult Result = new PlatformResult();
59         Result.setCode(code);
60         Result.setMsg(msg);
61         Result.setData(data);
62         return Result;
63     }
64
65     /*******************************************************************************/
66
67     public String getCode() {
68         return this.code;
69     }
70
71     public void setCode(final String code) {
72         this.code = code;
73     }
74
75     public String getMsg() {
76         return this.msg;
77     }
78
79     public void setMsg(final String msg) {
80         this.msg = msg;
81     }
82
83     public Object getData() {
84         return this.data;
85     }
86
87     public void setData(final Object data) {
88         this.data = data;
89     }
90
91 }
92