From 01b545e4abd20a92cb239b9d43f22881696a4b2a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 16 Mar 2021 14:43:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=94=A8Controller=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E8=BF=94=E5=9B=9E=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/controller/BaseController.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index c7912d71..136bbacb 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -84,6 +84,49 @@ public class BaseController 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); + } + /** * 页面跳转 */