package cn.com.ty.lift.enterprise.push;

import cn.com.ty.lift.common.constants.CommonEnum;
import cn.com.ty.lift.common.model.PushUserInfo;
import cn.com.ty.lift.enterprise.push.mapper.PushUserMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 推送用户
 *
 * @author wcz
 * @since 2020/4/24
 */
@Service
public class PushUserService extends ServiceImpl<PushUserMapper, PushUserInfo> {

    public PushUserInfo listByUserId(Long mtCompanyId, Long userId){
        return baseMapper.listByUserId(mtCompanyId, userId);
    }

    public List<PushUserInfo> listByUserIds(Long mtCompanyId, List<Long> userIds){
        return baseMapper.listByUserIds(mtCompanyId, userIds);
    }

    public List<PushUserInfo> listByRoleCodes(Long mtCompanyId, List<String> roleCodes){
        return baseMapper.listByRoleCodes(mtCompanyId, roleCodes);
    }

    /**
     * 查询公司下总经理
     */
    public List<PushUserInfo> listHighDirector(Long mtCompanyId){
        return baseMapper.listByRoleCode(mtCompanyId, CommonEnum.DefaultRole.HIGH_DIRECTOR.getCode());
    }
    /**
     * 查询公司下管理员
     */
    public List<PushUserInfo> listEnterpriseAdmin(Long mtCompanyId){
        return baseMapper.listByRoleCode(mtCompanyId, CommonEnum.DefaultRole.ENTERPRISE_ADMIN.getCode());
    }

    /**
     * 分页查询公司下所有的人员
     */
    public IPage<PushUserInfo> pageByMtCompany(IPage<PushUserInfo> page, Long mtCompanyId){
        return baseMapper.pageByMtCompany(page, mtCompanyId);
    }
}
