增加对AjaxResult消息结果类型的判断

master
RuoYi 2022-08-02 12:08:18 +08:00
parent 08f775da4b
commit 960dee7756
1 changed files with 35 additions and 14 deletions

View File

@ -1,6 +1,7 @@
package com.ruoyi.common.core.domain;
import java.util.HashMap;
import java.util.Objects;
import com.ruoyi.common.utils.StringUtils;
/**
@ -81,20 +82,6 @@ public class AjaxResult extends HashMap<String, Object>
}
}
/**
* 便
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
/**
*
*
@ -193,4 +180,38 @@ public class AjaxResult extends HashMap<String, Object>
{
return new AjaxResult(Type.ERROR, msg, data);
}
/**
*
*
* @return
*/
public boolean isSuccess()
{
return !isError();
}
/**
*
*
* @return
*/
public boolean isError()
{
return Objects.equals(Type.SUCCESS, this.get(CODE_TAG));
}
/**
* 便
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
}