Browse Source

R add isError and isSuccess method

RuoYi 2 years ago
parent
commit
f5bec70911
1 changed files with 10 additions and 0 deletions
  1. 10 0
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java

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

@@ -102,4 +102,14 @@ public class R<T> implements Serializable
     {
         this.data = data;
     }
+
+    public Boolean isError()
+    {
+        return !isSuccess();
+    }
+
+    public Boolean isSuccess()
+    {
+        return R.SUCCESS == getCode();
+    }
 }