package com.ningdatech.pmapi.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.user.entity.UserAuth;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper;
import com.ningdatech.pmapi.user.mapper.UserAuthMapper;
import com.ningdatech.pmapi.user.service.IUserAuthService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Lierbao
 * @since 2023-02-01
 */
@Service
@RequiredArgsConstructor
public class UserAuthServiceImpl extends ServiceImpl<UserAuthMapper, UserAuth> implements IUserAuthService {

    private final NdUserInfoMapper userInfoMapper;

    @Override
    public Map<Long, UserInfo> getUserMapByIds(Set<String> staterUsers) {
        List<UserInfo> userInfos = userInfoMapper.selectBatchIds(staterUsers);
        return userInfos.stream().collect(Collectors.toMap(UserInfo::getId, u -> u));
    }
}
