RuoYi
2023-11-07 8cf8c8acd059969b9e79ad1c2f9f1921cc42d69c
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
@@ -1,6 +1,7 @@
package com.ruoyi.common.core.domain;
import java.util.HashMap;
import java.util.Objects;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.utils.StringUtils;
@@ -127,7 +128,7 @@
    /**
     * 返回错误消息
     * 
     * @return
     * @return 错误消息
     */
    public static AjaxResult error()
    {
@@ -138,7 +139,7 @@
     * 返回错误消息
     * 
     * @param msg 返回内容
     * @return 警告消息
     * @return 错误消息
     */
    public static AjaxResult error(String msg)
    {
@@ -150,7 +151,7 @@
     * 
     * @param msg 返回内容
     * @param data 数据对象
     * @return 警告消息
     * @return 错误消息
     */
    public static AjaxResult error(String msg, Object data)
    {
@@ -162,7 +163,7 @@
     * 
     * @param code 状态码
     * @param msg 返回内容
     * @return 警告消息
     * @return 错误消息
     */
    public static AjaxResult error(int code, String msg)
    {
@@ -170,6 +171,36 @@
    }
    /**
     * 是否为成功消息
     *
     * @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 键