package com.platform.controller;

import com.platform.utils.ShiroUtils;
import com.platform.vos.CurrentUserLoginVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * Controller公共组件
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2016年11月9日 下午9:42:26
 */
public abstract class AbstractController {
    protected Logger logger = LoggerFactory.getLogger(getClass());

    protected CurrentUserLoginVo getUser() {
        return ShiroUtils.getUserEntity();
    }

    protected Long getUserId() {
        return getUser().getId();
    }

    protected  List<Long> getDeptId() {
        Long companyId = getUser().getCompanyId();
        List<Long> lists = new ArrayList<>();
        if(companyId!=null){
            lists.add(companyId);
        }
        return lists;
    }
    protected  Long getCompanyId() {
        return  getUser().getCompanyId();
    }
}
