package com.ruoyi.framework.interceptor;


import com.ruoyi.clock.domain.Employee;

public class UserContext {

    static final ThreadLocal<Employee> CTX = new ThreadLocal<>();

    private UserContext(Employee user) {
        CTX.set(user);
    }

    public static UserContext setUser(Employee user) {
        return new UserContext(user);
    }

    public static Employee currentUser() {
        return CTX.get();
    }


    public static void close() {
        CTX.remove();
    }
}
