From e9f2adb9ddc511c62e1628fbd527ba7cda8294d4 Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期五, 09 五月 2025 14:29:29 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/product-inventory-management-after

---
 src/main/java/com/ruoyi/framework/web/domain/AjaxResult.java |   76 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/ruoyi/framework/web/domain/AjaxResult.java b/src/main/java/com/ruoyi/framework/web/domain/AjaxResult.java
index 5c551bd..890aeaa 100644
--- a/src/main/java/com/ruoyi/framework/web/domain/AjaxResult.java
+++ b/src/main/java/com/ruoyi/framework/web/domain/AjaxResult.java
@@ -1,6 +1,7 @@
 package com.ruoyi.framework.web.domain;
 
 import java.util.HashMap;
+import java.util.Objects;
 import com.ruoyi.common.constant.HttpStatus;
 import com.ruoyi.common.utils.StringUtils;
 
@@ -102,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()
     {
@@ -115,7 +139,7 @@
      * 杩斿洖閿欒娑堟伅
      * 
      * @param msg 杩斿洖鍐呭
-     * @return 璀﹀憡娑堟伅
+     * @return 閿欒娑堟伅
      */
     public static AjaxResult error(String msg)
     {
@@ -127,7 +151,7 @@
      * 
      * @param msg 杩斿洖鍐呭
      * @param data 鏁版嵁瀵硅薄
-     * @return 璀﹀憡娑堟伅
+     * @return 閿欒娑堟伅
      */
     public static AjaxResult error(String msg, Object data)
     {
@@ -139,10 +163,54 @@
      * 
      * @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 isWarn()
+    {
+        return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
+    }
+
+    /**
+     * 鏄惁涓洪敊璇秷鎭�
+     *
+     * @return 缁撴灉
+     */
+    public boolean isError()
+    {
+        return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
+    }
+
+    /**
+     * 鏂逛究閾惧紡璋冪敤
+     *
+     * @param key 閿�
+     * @param value 鍊�
+     * @return 鏁版嵁瀵硅薄
+     */
+    @Override
+    public AjaxResult put(String key, Object value)
+    {
+        super.put(key, value);
+        return this;
+    }
 }

--
Gitblit v1.9.3