package com.ningdatech.pmapi.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.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum;
import com.ningdatech.pmapi.meta.mapper.ExpertDictionaryMapper;
import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary;
import com.ningdatech.pmapi.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, DictExpertInfoTypeEnum dictType) {
        // 获取专家职称
        LambdaQueryWrapper<ExpertDictionary> query = Wrappers.lambdaQuery(ExpertDictionary.class)
                .in(ExpertDictionary::getUserId, userIds)
                .eq(ExpertDictionary::getExpertInfoField, dictType.getKey());
        return list(query);
    }

}
