package com.vci.starter.web.util;
|
|
|
import com.alibaba.ttl.TransmittableThreadLocal;
|
import com.vci.starter.web.pagemodel.SessionInfo;
|
|
/**
|
* 线程中存储的变量信息
|
* @author weidy
|
*/
|
public class WebThreadLocalUtil {
|
|
/**
|
* 线程里的当前用户session信息
|
*/
|
private static TransmittableThreadLocal<SessionInfo> currentUserSessionInfoInThread = new TransmittableThreadLocal<SessionInfo>();
|
|
/**
|
* 查询列表的时候是否查询总数
|
*/
|
private static TransmittableThreadLocal<String> needQueryTotalInThread = new TransmittableThreadLocal<String>();
|
|
/**
|
* 线程里的当前token信息
|
*/
|
private static TransmittableThreadLocal<String> tokenThread = new TransmittableThreadLocal<String>();
|
|
/**
|
* 获取当前用户的session对象
|
* @return session对象
|
*/
|
public static SessionInfo getCurrentUserSessionInfoInThread() {
|
return currentUserSessionInfoInThread.get();
|
}
|
|
public static void setCurrentUserSessionInfoInThread(SessionInfo sessionInfo) {
|
currentUserSessionInfoInThread.set(sessionInfo);
|
}
|
|
public static String getNeedQueryTotalInThread() {
|
return needQueryTotalInThread.get();
|
}
|
|
public static void setNeedQueryTotalInThread(String needQueryTotal) {
|
needQueryTotalInThread.set(needQueryTotal);
|
}
|
|
public static String getTokenInThread() {
|
return tokenThread.get();
|
}
|
|
public static void setTokenInThread(String token) {
|
tokenThread.set(token);
|
}
|
}
|