package shop.alien.store.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import shop.alien.entity.store.EvaluationLabel;
import shop.alien.mapper.EvaluationLabelMapper;
import shop.alien.store.service.EvaluationLabelService;

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

/**
 * <p>
 * 评论标签 服务实现类
 * </p>
 *
 * @author ssk
 * @since 2025-05-15
 */
@Service
@RequiredArgsConstructor
public class EvaluationLabelServiceImpl extends ServiceImpl<EvaluationLabelMapper, EvaluationLabel> implements EvaluationLabelService {

    private final EvaluationLabelMapper evaluationLabelMapper;

    @Override
    public Set<String> getLabel(String storeId, List<String> lables) {
        QueryWrapper<EvaluationLabel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("store_id", storeId).in("label", lables);
        List<EvaluationLabel> res = evaluationLabelMapper.selectList(queryWrapper);
        return res.stream().map(EvaluationLabel::getEvaluationId).collect(Collectors.toSet());
    }
}
