package com.ningdatech.pmapi.expert.service;

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

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

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author Liuxinxin
 * @since 2023-02-22
 */
public interface IExpertUserFullInfoService extends IService<ExpertUserFullInfo> {


    /**
     * 查询用户信息
     *
     * @param userId 用户ID
     * @return /
     **/
    ExpertUserFullInfo getByUserId(Long userId);

    /**
     * 查询用户信息
     *
     * @param userId 用户ID
     * @return /
     **/
    List<ExpertUserFullInfo> listByUserId(List<Long> userId);


    /**
     * 批量查询专家用户信息
     *
     * @param userIds 用户ID
     * @return /
     */
    List<ExpertUserFullInfo> listByUserIds(List<Long> userIds);

    default List<String> listCompanyUniqCodeByUserIds(Collection<Long> userIds) {
        LambdaQueryWrapper<ExpertUserFullInfo> query = Wrappers
                .lambdaQuery(ExpertUserFullInfo.class)
                .select(ExpertUserFullInfo::getCompanyUniqCode)
                .in(ExpertUserFullInfo::getUserId, userIds);
        return CollUtils.fieldList(list(query), ExpertUserFullInfo::getCompanyUniqCode);
    }

}
