package com.hz.pm.api.meta.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hz.pm.api.meta.constant.ExpertDictTypeEnum;
import com.hz.pm.api.meta.mapper.ExpertDictionaryMapper;
import com.hz.pm.api.meta.model.entity.ExpertDictionary;
import com.hz.pm.api.meta.service.IExpertDictionaryService;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Liuxinxin
 * @since 2023-02-22
 */
@Service
public class ExpertDictionaryServiceImpl extends ServiceImpl<ExpertDictionaryMapper, ExpertDictionary> implements IExpertDictionaryService {

    @Override
    public List<ExpertDictionary> listByUserId(Collection<Long> userIds, ExpertDictTypeEnum dictType) {
        // 获取专家职称
        LambdaQueryWrapper<ExpertDictionary> query = Wrappers.lambdaQuery(ExpertDictionary.class)
                .in(ExpertDictionary::getUserId, userIds)
                .eq(ExpertDictionary::getExpertInfoField, dictType.getKey());
        return list(query);
    }

    @Override
    public List<ExpertDictionary> listByUserId(Collection<Long> userIds) {
        LambdaQueryWrapper<ExpertDictionary> query = Wrappers.lambdaQuery(ExpertDictionary.class)
                .in(ExpertDictionary::getUserId, userIds);
        return list(query);
    }
}
