package com.izouma.nineth.web;

import com.izouma.nineth.domain.User;
import com.izouma.nineth.exception.BusinessException;
import com.izouma.nineth.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BaseController {

    /**
     * 获取当前用户
     * @return
     */
    protected User currentUser(){
        final User user = SecurityUtils.getAuthenticatedUser();
        if(user == null){
            throw new BusinessException("获取当前用户信息失败");
        }
        return user;
    }

}
