From 6ca853516671882e8e54d9630a4299f12fbcf9aa Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期四, 13 一月 2022 11:14:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/satoken' into dev

---
 ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java |   97 ++++++++++++++++++++----------------------------
 1 files changed, 41 insertions(+), 56 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 3915867..4c5e197 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
@@ -2,19 +2,43 @@
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
-import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.LoginUtils;
 import com.ruoyi.common.utils.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * web灞傞�氱敤鏁版嵁澶勭悊
  *
  * @author ruoyi
  */
-public class BaseController
-{
-    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
+public class BaseController {
+
+    /**
+     * 杩斿洖鎴愬姛
+     */
+    public AjaxResult<Void> success() {
+        return AjaxResult.success();
+    }
+
+    /**
+     * 杩斿洖澶辫触娑堟伅
+     */
+    public AjaxResult<Void> error() {
+        return AjaxResult.error();
+    }
+
+    /**
+     * 杩斿洖鎴愬姛娑堟伅
+     */
+    public AjaxResult<Void> success(String message) {
+        return AjaxResult.success(message);
+    }
+
+    /**
+     * 杩斿洖澶辫触娑堟伅
+     */
+    public AjaxResult<Void> error(String message) {
+        return AjaxResult.error(message);
+    }
 
     /**
      * 鍝嶅簲杩斿洖缁撴灉
@@ -22,8 +46,7 @@
      * @param rows 褰卞搷琛屾暟
      * @return 鎿嶄綔缁撴灉
      */
-    protected AjaxResult<Void> toAjax(int rows)
-    {
+    protected AjaxResult<Void> toAjax(int rows) {
         return rows > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
@@ -33,80 +56,42 @@
      * @param result 缁撴灉
      * @return 鎿嶄綔缁撴灉
      */
-    protected AjaxResult<Void> toAjax(boolean result)
-    {
+    protected AjaxResult<Void> toAjax(boolean result) {
         return result ? success() : error();
-    }
-
-    /**
-     * 杩斿洖鎴愬姛
-     */
-    public AjaxResult<Void> success()
-    {
-        return AjaxResult.success();
-    }
-
-    /**
-     * 杩斿洖澶辫触娑堟伅
-     */
-    public AjaxResult<Void> error()
-    {
-        return AjaxResult.error();
-    }
-
-    /**
-     * 杩斿洖鎴愬姛娑堟伅
-     */
-    public AjaxResult<Void> success(String message)
-    {
-        return AjaxResult.success(message);
-    }
-
-    /**
-     * 杩斿洖澶辫触娑堟伅
-     */
-    public AjaxResult<Void> error(String message)
-    {
-        return AjaxResult.error(message);
     }
 
     /**
      * 椤甸潰璺宠浆
      */
-    public String redirect(String url)
-    {
+    public String redirect(String url) {
         return StringUtils.format("redirect:{}", url);
     }
 
     /**
      * 鑾峰彇鐢ㄦ埛缂撳瓨淇℃伅
      */
-    public LoginUser getLoginUser()
-    {
-        return SecurityUtils.getLoginUser();
+    public LoginUser getLoginUser() {
+        return LoginUtils.getLoginUser();
     }
 
     /**
      * 鑾峰彇鐧诲綍鐢ㄦ埛id
      */
-    public Long getUserId()
-    {
-        return getLoginUser().getUserId();
+    public Long getUserId() {
+        return LoginUtils.getUserId();
     }
 
     /**
      * 鑾峰彇鐧诲綍閮ㄩ棬id
      */
-    public Long getDeptId()
-    {
-        return getLoginUser().getDeptId();
+    public Long getDeptId() {
+        return LoginUtils.getDeptId();
     }
 
     /**
      * 鑾峰彇鐧诲綍鐢ㄦ埛鍚�
      */
-    public String getUsername()
-    {
-        return getLoginUser().getUsername();
+    public String getUsername() {
+        return LoginUtils.getUsername();
     }
 }

--
Gitblit v1.9.3