mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 12:39:05 +08:00
♻️ Refactoring code. close #I7PVTQ 登录日志的创建人不对
This commit is contained in:
1 parent
c37b60e9dd
commit
3aa2a54b56
1 file changed
+7
-2
+7
-2
@@ -79,12 +79,17 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
|
||||
* @return 当前用户名
|
||||
*/
|
||||
private String getUserName() {
|
||||
Authentication authentication = SecurityUtils.getAuthentication();
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
// 匿名接口直接返回
|
||||
if (authentication instanceof AnonymousAuthenticationToken) {
|
||||
return null;
|
||||
}
|
||||
return authentication.getName();
|
||||
|
||||
if (Optional.ofNullable(authentication).isPresent()) {
|
||||
return authentication.getName();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user