Browse Source

feat: add isError and isSuccess method

Signed-off-by: runphp <runphp@qq.com>
runphp 3 years ago
parent
commit
732071ef58

+ 8 - 0
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/R.java

@@ -102,4 +102,12 @@ public class R<T> implements Serializable
102 102
     {
103 103
         this.data = data;
104 104
     }
105
+
106
+    public Boolean isError() {
107
+        return !isSuccess();
108
+    }
109
+    
110
+    public Boolean isSuccess() {
111
+        return R.SUCCESS == getCode();
112
+    }
105 113
 }