From a8be0ccb35828ec333d5a88ff125db53739ba4ae Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Sat, 03 Dec 2022 13:20:48 +0800
Subject: [PATCH] 修复Log注解GET请求记录不到参数问题
---
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/AjaxResult.java | 80 +++++++++++++++++++++++++++++++---------
1 files changed, 62 insertions(+), 18 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..583d35e 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,9 +103,32 @@
}
/**
+ * 返回警告消息
+ *
+ * @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
+ * @return 错误消息
*/
public static AjaxResult error()
{
@@ -129,7 +139,7 @@
* 返回错误消息
*
* @param msg 返回内容
- * @return 警告消息
+ * @return 错误消息
*/
public static AjaxResult error(String msg)
{
@@ -141,7 +151,7 @@
*
* @param msg 返回内容
* @param data 数据对象
- * @return 警告消息
+ * @return 错误消息
*/
public static AjaxResult error(String msg, Object data)
{
@@ -153,10 +163,44 @@
*
* @param code 状态码
* @param msg 返回内容
- * @return 警告消息
+ * @return 错误消息
*/
public static AjaxResult error(int code, String msg)
{
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