| | |
| | | import com.alibaba.ttl.TransmittableThreadLocal; |
| | | import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy; |
| | | import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.dromara.common.core.constant.GlobalConstants; |
| | | import org.dromara.common.core.utils.SpringUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | | import org.dromara.common.redis.utils.RedisUtils; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import lombok.AccessLevel; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.function.Supplier; |
| | | |
| | | /** |
| | | * 租户助手 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 在忽略租户中执行 |
| | | * |
| | | * @param handle 处理执行方法 |
| | | */ |
| | | public static void ignore(Runnable handle) { |
| | | enableIgnore(); |
| | | try { |
| | | handle.run(); |
| | | } finally { |
| | | disableIgnore(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 在忽略租户中执行 |
| | | * |
| | | * @param handle 处理执行方法 |
| | | */ |
| | | public static <T> T ignore(Supplier<T> handle) { |
| | | enableIgnore(); |
| | | try { |
| | | return handle.get(); |
| | | } finally { |
| | | disableIgnore(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置动态租户(一直有效 需要手动清理) |
| | | * <p> |
| | | * 如果为非web环境 那么只在当前线程内生效 |