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.erp.SysUserMapper;
import com.zanxiang.game.gs.data.serve.pojo.entity.erp.SysUser;
import com.zanxiang.game.gs.data.serve.service.ISysUserService;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;

import static com.zanxiang.game.gs.data.serve.pojo.entity.erp.table.SysUserTableDef.SYS_USER;

/**
 * 用户信息表 服务层实现。
 *
 * @author shaosong
 * @since 1.0
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {

    @Override
    public Map<Long,String> getSysUserMap(Collection<Long> userIdList) {
        return list(new QueryWrapper()
                        .select(SYS_USER.NICKNAME, SYS_USER.USER_ID)
                        .in(SysUser::getUserId, userIdList))
                .stream()
                .collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickname));
    }
}