package com.zanxiang.game.gs.data.serve.service.impl;


import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.zanxiang.game.gs.data.serve.dao.mapper.game.order.GameMapper;
import com.zanxiang.game.gs.data.serve.pojo.entity.game.order.Game;
import com.zanxiang.game.gs.data.serve.service.IGameService;
import org.springframework.stereotype.Service;

import jakarta.validation.constraints.NotBlank;
import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 游戏表 服务层实现。
 *
 * @author shaosong
 * @since 1.0
 */
@Service
public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IGameService {

    @Override
    public Map<Integer, String> gameNameMap(@NotBlank String sourceSystem, Collection<Integer> gameIdList) {
        return list(new QueryWrapper()
                .eq(Game::getSourceSystem, sourceSystem)
                .in(Game::getId, gameIdList))
                .stream()
                .collect(Collectors.toMap(Game::getId, Game::getGameName));
    }
}