From 88c2e4979a53621db8b00b8e11a7c499febcd2da Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Sat, 21 Mar 2026 23:29:22 +0800
Subject: [PATCH] 新增锁定屏幕功能
---
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/AjaxResult.java | 45 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 39 insertions(+), 6 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 814b0c2..61d00ae 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
@@ -103,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()
{
@@ -116,7 +139,7 @@
* 返回错误消息
*
* @param msg 返回内容
- * @return 警告消息
+ * @return 错误消息
*/
public static AjaxResult error(String msg)
{
@@ -128,7 +151,7 @@
*
* @param msg 返回内容
* @param data 数据对象
- * @return 警告消息
+ * @return 错误消息
*/
public static AjaxResult error(String msg, Object data)
{
@@ -140,7 +163,7 @@
*
* @param code 状态码
* @param msg 返回内容
- * @return 警告消息
+ * @return 错误消息
*/
public static AjaxResult error(int code, String msg)
{
@@ -154,7 +177,17 @@
*/
public boolean isSuccess()
{
- return !isError();
+ return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
+ }
+
+ /**
+ * 是否为警告消息
+ *
+ * @return 结果
+ */
+ public boolean isWarn()
+ {
+ return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
/**
@@ -164,7 +197,7 @@
*/
public boolean isError()
{
- return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
+ return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
}
/**
--
Gitblit v1.9.3