From 01b545e4abd20a92cb239b9d43f22881696a4b2a Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期二, 16 三月 2021 14:43:55 +0800
Subject: [PATCH] 通用Controller添加响应返回消息
---
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
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 c7912d7..136bbac 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
@@ -85,6 +85,49 @@
}
/**
+ * 鍝嶅簲杩斿洖缁撴灉
+ *
+ * @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);
+ }
+
+ /**
* 椤甸潰璺宠浆
*/
public String redirect(String url)
--
Gitblit v1.9.3