package com.ningdatech.pmapi.meeting.service;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge;
import com.baomidou.mybatisplus.extension.service.IService;

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

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author CMM
 * @since 2023-07-31
 */
public interface IMeetingExpertJudgeService extends IService<MeetingExpertJudge> {

    default List<Long> listExistsMeetingExpertIds(Collection<Long> meetingExpertIds) {
        if (CollUtil.isEmpty(meetingExpertIds)) {
            return Collections.emptyList();
        }
        LambdaQueryWrapper<MeetingExpertJudge> query = Wrappers.lambdaQuery(MeetingExpertJudge.class)
                .select(MeetingExpertJudge::getMeetingExpertId)
                .in(MeetingExpertJudge::getMeetingExpertId, meetingExpertIds);
        return CollUtils.fieldList(list(query), MeetingExpertJudge::getMeetingExpertId);
    }

}
