wu
2024-08-27 2bb5874750f30f1e7c8c5c2df66c24dcf78b9b9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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();
        }
    }
}