package com.fdkankan.ucenter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fdkankan.ucenter.entity.Goods;
import com.fdkankan.ucenter.mapper.IGoodsMapper;
import com.fdkankan.ucenter.service.IGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 商品主表 服务实现类
 * </p>
 *
 * @author 
 * @since 2022-07-13
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<IGoodsMapper, Goods> implements IGoodsService {

    @Override
    public HashMap<Long, Goods> getByIds(List<Long> goodsIds) {
        LambdaQueryWrapper<Goods> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(Goods::getId,goodsIds);
        List<Goods> list = this.list(wrapper);
        HashMap<Long,Goods> map = new HashMap<>();
        list.forEach(entity-> map.put(entity.getId(),entity));
        return map;
    }
}
