package com.ltkj.framework.config;
|
|
import com.ltkj.common.core.domain.model.LoginUser;
|
import com.ltkj.hosp.domain.Wxuser;
|
|
/**
|
* @Author: 西安路泰科技有限公司/赵佳豪
|
* @Date: 2022/11/17 10:26
|
*/
|
|
//工具类:实现向threadLocal存储数据
|
public class UserHoder {
|
private static ThreadLocal<Wxuser> tl = new ThreadLocal<>();
|
private static ThreadLocal<LoginUser> tt = new ThreadLocal<>();
|
|
//将用户存入theradlocal
|
public static void set(Wxuser wxuser) {
|
tl.set(wxuser);
|
}
|
|
public static void setLoginUser(LoginUser loginUser) {
|
tt.set(loginUser);
|
}
|
|
//从当前线程获取用户id
|
public static Wxuser getWxuser() {
|
return tl.get();
|
}
|
|
public static LoginUser getLoginUser() {
|
return tt.get();
|
}
|
}
|