提交 | 用户 | 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 |
|
3e7377
|
14 |
/**总编码*/ |
6c1bfc
|
15 |
private String code; |
3e7377
|
16 |
/**子编码*/ |
C |
17 |
private String subCode = "100"; |
6c1bfc
|
18 |
|
C |
19 |
private String msg; |
|
20 |
|
|
21 |
private Object data; |
|
22 |
|
|
23 |
public PlatformResult() {} |
|
24 |
|
|
25 |
public PlatformResult(String code, String msg) { |
|
26 |
this.code = code; |
|
27 |
this.msg = msg; |
|
28 |
} |
|
29 |
|
|
30 |
public static PlatformResult success() { |
|
31 |
PlatformResult Result = new PlatformResult(); |
|
32 |
Result.setCode(PlatformCode.SUCCESS); |
|
33 |
Result.setMsg("SUCCESS"); |
|
34 |
return Result; |
|
35 |
} |
|
36 |
|
|
37 |
public static PlatformResult success(Object data) { |
|
38 |
PlatformResult Result = new PlatformResult(); |
|
39 |
Result.setCode(PlatformCode.SUCCESS); |
|
40 |
Result.setData(data); |
|
41 |
Result.setMsg("SUCCESS"); |
|
42 |
return Result; |
|
43 |
} |
|
44 |
|
|
45 |
public static PlatformResult success(String code, String msg,Object data) { |
|
46 |
PlatformResult Result = new PlatformResult(); |
|
47 |
Result.setCode(code); |
|
48 |
Result.setData(data); |
|
49 |
Result.setMsg(msg); |
|
50 |
return Result; |
|
51 |
} |
|
52 |
|
|
53 |
public static PlatformResult failure(String code, String msg) { |
|
54 |
PlatformResult Result = new PlatformResult(); |
|
55 |
Result.setCode(code); |
|
56 |
Result.setMsg(msg); |
|
57 |
return Result; |
|
58 |
} |
|
59 |
|
3e7377
|
60 |
public static PlatformResult failure(String code,String subCode, String msg) { |
C |
61 |
PlatformResult Result = new PlatformResult(); |
|
62 |
Result.setCode(code); |
|
63 |
Result.setMsg(msg); |
|
64 |
Result.setSubCode(subCode); |
|
65 |
return Result; |
|
66 |
} |
|
67 |
|
6c1bfc
|
68 |
public static PlatformResult failure(String code, String msg, Object data) { |
C |
69 |
PlatformResult Result = new PlatformResult(); |
|
70 |
Result.setCode(code); |
|
71 |
Result.setMsg(msg); |
|
72 |
Result.setData(data); |
3e7377
|
73 |
return Result; |
C |
74 |
} |
|
75 |
|
|
76 |
public static PlatformResult failure(String code,String subCode, String msg, Object data) { |
|
77 |
PlatformResult Result = new PlatformResult(); |
|
78 |
Result.setCode(code); |
|
79 |
Result.setMsg(msg); |
|
80 |
Result.setData(data); |
|
81 |
Result.setSubCode(subCode); |
6c1bfc
|
82 |
return Result; |
C |
83 |
} |
|
84 |
|
|
85 |
/*******************************************************************************/ |
|
86 |
|
|
87 |
public String getCode() { |
|
88 |
return this.code; |
|
89 |
} |
|
90 |
|
|
91 |
public void setCode(final String code) { |
|
92 |
this.code = code; |
|
93 |
} |
|
94 |
|
|
95 |
public String getMsg() { |
|
96 |
return this.msg; |
|
97 |
} |
|
98 |
|
|
99 |
public void setMsg(final String msg) { |
|
100 |
this.msg = msg; |
|
101 |
} |
|
102 |
|
|
103 |
public Object getData() { |
|
104 |
return this.data; |
|
105 |
} |
|
106 |
|
|
107 |
public void setData(final Object data) { |
|
108 |
this.data = data; |
|
109 |
} |
|
110 |
|
3e7377
|
111 |
public String getSubCode() { |
C |
112 |
return subCode; |
|
113 |
} |
|
114 |
|
|
115 |
public void setSubCode(String subCode) { |
|
116 |
this.subCode = subCode; |
|
117 |
} |
6c1bfc
|
118 |
} |
C |
119 |
|