wangfei
2024-08-22 a9c266890270e55a5840411b6d0fd4fe43494af8
hangzhoumesParent/common/springsecurity/src/main/java/com/mes/common/utils/UserInfoUtils.java
New file
@@ -0,0 +1,26 @@
package com.mes.common.utils;
import com.mes.userinfo.entity.SysUser;
/**
 * @Author : zhoush
 * @Date: 2024/4/25 15:41
 * @Description:
 */
public class UserInfoUtils {
    private static InheritableThreadLocal<SysUser> tokenPool = new InheritableThreadLocal<SysUser>();
    public static SysUser get() {
        return tokenPool.get();
    }
    public static void set(SysUser user) {
        tokenPool.set(user);
    }
    public static void remove() {
        if (get() != null) {
            tokenPool.remove();
        }
    }
}