6 changed files with 68 additions and 2 deletions
@ -0,0 +1,27 @@ |
|||
package com.tduck.cloud.account.util; |
|||
|
|||
import com.tduck.cloud.account.vo.LoginUserVO; |
|||
|
|||
/** |
|||
* desc: 用户信息ThreadLocal 暂时只有用户Id和customerId |
|||
* |
|||
* @author: LiuJanJun |
|||
* @date: 2021/9/15 1:26 下午 |
|||
* @version: 1.0 |
|||
*/ |
|||
public class LoginUserUtil { |
|||
private static ThreadLocal<LoginUserVO> userThread = new ThreadLocal<>(); |
|||
|
|||
public static void set(LoginUserVO user){ |
|||
userThread.set(user); |
|||
} |
|||
|
|||
public static LoginUserVO get(){ |
|||
return userThread.get(); |
|||
} |
|||
|
|||
//防止内存泄漏
|
|||
public static void remove(){ |
|||
userThread.remove(); |
|||
} |
|||
} |
Loading…
Reference in new issue