love.keeping.starter.web.interceptors.TenantInterceptorImpl Maven / Gradle / Ivy
The newest version!
package love.keeping.starter.web.interceptors;
import love.keeping.starter.web.components.tenant.TenantInterceptor;
import love.keeping.starter.web.common.tenant.TenantContextHolder;
import love.keeping.starter.web.common.security.SecurityUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TenantInterceptorImpl implements TenantInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
Integer tenantId = SecurityUtil.getCurrentTenantId();
if (tenantId != null) {
TenantContextHolder.setTenantId(tenantId);
return true;
}
return true;
}
}