From 3e73778bdaf84c8398e0b8bdb1bc339b3160ff78 Mon Sep 17 00:00:00 2001 From: chenjiahe <763432473@qq.com> Date: 星期三, 15 十二月 2021 14:55:41 +0800 Subject: [PATCH] 新增子状态 --- src/main/java/com/platform/exception/PlatTipsException.java | 23 +++++++++++++++++++++++ src/main/java/com/platform/resultTool/PlatformResult.java | 27 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/platform/exception/PlatTipsException.java b/src/main/java/com/platform/exception/PlatTipsException.java index 5008c7d..13594f9 100644 --- a/src/main/java/com/platform/exception/PlatTipsException.java +++ b/src/main/java/com/platform/exception/PlatTipsException.java @@ -7,16 +7,31 @@ */ public class PlatTipsException extends RuntimeException { + /**鎬荤紪鐮�*/ private String code; + /**瀛愮紪鐮�*/ + private String subCode = "100"; public PlatTipsException( String code,String message) { super(message); this.code = code; } + public PlatTipsException( String code,String subCode,String message) { + super(message); + this.code = code; + this.subCode = subCode; + } + public PlatTipsException( String code,String message, Throwable cause) { super(message, cause); this.code = code; + } + + public PlatTipsException( String code,String subCode,String message, Throwable cause) { + super(message, cause); + this.code = code; + this.subCode = subCode; } public PlatTipsException(String code,Throwable cause) { @@ -33,4 +48,12 @@ public void setCode(String code) { this.code = code; } + + public String getSubCode() { + return subCode; + } + + public void setSubCode(String subCode) { + this.subCode = subCode; + } } diff --git a/src/main/java/com/platform/resultTool/PlatformResult.java b/src/main/java/com/platform/resultTool/PlatformResult.java index fb02e72..956608d 100644 --- a/src/main/java/com/platform/resultTool/PlatformResult.java +++ b/src/main/java/com/platform/resultTool/PlatformResult.java @@ -11,7 +11,10 @@ private static final long serialVersionUID = -3948389268046368059L; + /**鎬荤紪鐮�*/ private String code; + /**瀛愮紪鐮�*/ + private String subCode = "100"; private String msg; @@ -54,11 +57,28 @@ 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; } @@ -88,5 +108,12 @@ this.data = data; } + public String getSubCode() { + return subCode; + } + + public void setSubCode(String subCode) { + this.subCode = subCode; + } } -- Gitblit v1.8.0