From da1cb2874c7a686425c6bb7ccb722de09d435116 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Thu, 24 Jul 2025 12:12:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=99=BB=E5=BD=95=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E7=AD=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java index aef2266..43fe118 100644 --- a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java +++ b/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java @@ -192,7 +192,9 @@ public class MybatisInterceptor implements Interceptor { private LoginUser getLoginUser() { LoginUser sysUser = null; try { - sysUser = SecurityUtils.getSubject().getPrincipal() != null ? (LoginUser) SecurityUtils.getSubject().getPrincipal() : null; + if (SecurityUtils.getSubject().getPrincipal() != null && SecurityUtils.getSubject().getPrincipal() instanceof LoginUser){ + sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + } } catch (Exception e) { //e.printStackTrace(); sysUser = null;