From 6e5d7a6dab441eaa6d4ebca8cb8fc6fb2919d4e2 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Mon, 14 Nov 2022 11:34:59 +0800
Subject: [PATCH] 升级druid到最新版本1.2.14
---
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/AjaxResult.java | 72 +++++++++++++++++++++++++++++-------
1 files changed, 58 insertions(+), 14 deletions(-)
diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/AjaxResult.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/AjaxResult.java
index 626f4af..c1e4b82 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/AjaxResult.java
+++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/AjaxResult.java
@@ -1,6 +1,7 @@
package com.ruoyi.common.core.web.domain;
import java.util.HashMap;
+import java.util.Objects;
import com.ruoyi.common.core.constant.HttpStatus;
import com.ruoyi.common.core.utils.StringUtils;
@@ -57,20 +58,6 @@
super.put(DATA_TAG, data);
}
}
-
- /**
- * 方便链式调用
- *
- * @param key
- * @param value
- * @return
- */
- @Override
- public AjaxResult put(String key, Object value)
- {
- super.put(key, value);
- return this;
- }
/**
* 返回成功消息
@@ -116,6 +103,29 @@
}
/**
+ * 返回警告消息
+ *
+ * @param msg 返回内容
+ * @return 警告消息
+ */
+ public static AjaxResult warn(String msg)
+ {
+ return AjaxResult.warn(msg, null);
+ }
+
+ /**
+ * 返回警告消息
+ *
+ * @param msg 返回内容
+ * @param data 数据对象
+ * @return 警告消息
+ */
+ public static AjaxResult warn(String msg, Object data)
+ {
+ return new AjaxResult(HttpStatus.WARN, msg, data);
+ }
+
+ /**
* 返回错误消息
*
* @return
@@ -159,4 +169,38 @@
{
return new AjaxResult(code, msg, null);
}
+
+ /**
+ * 是否为成功消息
+ *
+ * @return 结果
+ */
+ public boolean isSuccess()
+ {
+ return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
+ }
+
+ /**
+ * 是否为错误消息
+ *
+ * @return 结果
+ */
+ public boolean isError()
+ {
+ return !isSuccess();
+ }
+
+ /**
+ * 方便链式调用
+ *
+ * @param key
+ * @param value
+ * @return
+ */
+ @Override
+ public AjaxResult put(String key, Object value)
+ {
+ super.put(key, value);
+ return this;
+ }
}
--
Gitblit v1.9.3