通用Controller添加响应返回消息

This commit is contained in:
RuoYi 2021-03-16 14:43:55 +08:00
parent c2e9200626
commit 01b545e4ab
1 changed files with 43 additions and 0 deletions

View File

@ -84,6 +84,49 @@ public class BaseController
return rows > 0 ? AjaxResult.success() : AjaxResult.error(); return rows > 0 ? AjaxResult.success() : AjaxResult.error();
} }
/**
* 响应返回结果
*
* @param result 结果
* @return 操作结果
*/
protected AjaxResult toAjax(boolean result)
{
return result ? success() : error();
}
/**
* 返回成功
*/
public AjaxResult success()
{
return AjaxResult.success();
}
/**
* 返回失败消息
*/
public AjaxResult error()
{
return AjaxResult.error();
}
/**
* 返回成功消息
*/
public AjaxResult success(String message)
{
return AjaxResult.success(message);
}
/**
* 返回失败消息
*/
public AjaxResult error(String message)
{
return AjaxResult.error(message);
}
/** /**
* 页面跳转 * 页面跳转
*/ */