package com.platform.resultTool;
|
|
import java.io.Serializable;
|
|
/**
|
* 开发平台统一返回格式
|
* @author chenjiahe
|
* @Data: 2021-10-20
|
*/
|
public class PlatformResult implements Serializable {
|
|
private static final long serialVersionUID = -3948389268046368059L;
|
|
/**总编码*/
|
private String code;
|
/**子编码*/
|
private String subCode = "100";
|
|
private String msg;
|
|
private Object data;
|
|
public PlatformResult() {}
|
|
public PlatformResult(String code, String msg) {
|
this.code = code;
|
this.msg = msg;
|
}
|
|
public static PlatformResult success() {
|
PlatformResult Result = new PlatformResult();
|
Result.setCode(PlatformCode.SUCCESS);
|
Result.setMsg("SUCCESS");
|
return Result;
|
}
|
|
public static PlatformResult success(Object data) {
|
PlatformResult Result = new PlatformResult();
|
Result.setCode(PlatformCode.SUCCESS);
|
Result.setData(data);
|
Result.setMsg("SUCCESS");
|
return Result;
|
}
|
|
public static PlatformResult success(String code, String msg,Object data) {
|
PlatformResult Result = new PlatformResult();
|
Result.setCode(code);
|
Result.setData(data);
|
Result.setMsg(msg);
|
return Result;
|
}
|
|
public static PlatformResult failure(String code, String msg) {
|
PlatformResult Result = new PlatformResult();
|
Result.setCode(code);
|
Result.setMsg(msg);
|
return Result;
|
}
|
|
public static PlatformResult failure(String code,String subCode, String msg) {
|
PlatformResult Result = new PlatformResult();
|
Result.setCode(code);
|
Result.setMsg(msg);
|
Result.setSubCode(subCode);
|
return Result;
|
}
|
|
public static PlatformResult failure(String code, String msg, Object data) {
|
PlatformResult Result = new PlatformResult();
|
Result.setCode(code);
|
Result.setMsg(msg);
|
Result.setData(data);
|
return Result;
|
}
|
|
public static PlatformResult failure(String code,String subCode, String msg, Object data) {
|
PlatformResult Result = new PlatformResult();
|
Result.setCode(code);
|
Result.setMsg(msg);
|
Result.setData(data);
|
Result.setSubCode(subCode);
|
return Result;
|
}
|
|
/*******************************************************************************/
|
|
public String getCode() {
|
return this.code;
|
}
|
|
public void setCode(final String code) {
|
this.code = code;
|
}
|
|
public String getMsg() {
|
return this.msg;
|
}
|
|
public void setMsg(final String msg) {
|
this.msg = msg;
|
}
|
|
public Object getData() {
|
return this.data;
|
}
|
|
public void setData(final Object data) {
|
this.data = data;
|
}
|
|
public String getSubCode() {
|
return subCode;
|
}
|
|
public void setSubCode(String subCode) {
|
this.subCode = subCode;
|
}
|
}
|