苍穹外卖初始化代码
This commit is contained in:
19
sky-common/src/main/java/com/sky/context/BaseContext.java
Normal file
19
sky-common/src/main/java/com/sky/context/BaseContext.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.sky.context;
|
||||
|
||||
public class BaseContext {
|
||||
|
||||
public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
|
||||
|
||||
public static void setCurrentId(Long id) {
|
||||
threadLocal.set(id);
|
||||
}
|
||||
|
||||
public static Long getCurrentId() {
|
||||
return threadLocal.get();
|
||||
}
|
||||
|
||||
public static void removeCurrentId() {
|
||||
threadLocal.remove();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user