package com.xkrs.service.impl;

import com.xkrs.dao.RelRoleAuthorityDao;
import com.xkrs.dao.SysAuthorityDao;
import com.xkrs.model.entity.SysAuthorityEntity;
import com.xkrs.service.SysAuthorityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 系统权限服务实现
 * @author tajochen
 */
@Service
public class SysAuthorityServiceImpl implements SysAuthorityService {

    Logger logger = LoggerFactory.getLogger(SysAuthorityServiceImpl.class);

    @Resource
    private SysAuthorityDao sysAuthorityDao;

    @Resource
    private RelRoleAuthorityDao relRoleAuthorityDao;

    @Override
    public List<SysAuthorityEntity> getSysAuthorityListByUserName(String userName) {
        return  sysAuthorityDao.selectByUserName(userName);
    }

    @Override
    public List<SysAuthorityEntity> findAllByIdIn(List<Integer> id) {
        return sysAuthorityDao.findAllByIdIn(id);
    }

    @Override
    public List<Integer> selectAuthorityByUserId(Integer userId) {
        return relRoleAuthorityDao.selectAuthorityByUserId(userId);
    }
}
