package com.younike.framework.web.domain;

/**
 * 服务人员用户
 *
 * @author chenpengfei
 */
public class ServerUserContext implements AutoCloseable {

    static final ThreadLocal<Long> ctx = new ThreadLocal<>();

    public ServerUserContext(Long user) {
        ctx.set(user);
    }

    public static Long currentUser() {
        return ctx.get();
    }

    @Override
    public void close() {
        ctx.remove();
    }
}