package com.friday.custody.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.friday.custody.entity.FundFeeDataInfoEntity;
import org.apache.ibatis.annotations.Mapper;

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

/**
 * 基金费用数据表（fund_fee_data_info）
 * 
 * @author chenyy
 * @date 2022-07-01 16:19:43
 */
@Mapper
public interface FundFeeDataInfoDao extends BaseMapper<FundFeeDataInfoEntity> {

    default Set<String> queryUniqueKeyList(List<String> uniqueKeyList){
        LambdaQueryWrapper<FundFeeDataInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.select(FundFeeDataInfoEntity::getUniqueKey).in(FundFeeDataInfoEntity::getUniqueKey, uniqueKeyList);
        List<FundFeeDataInfoEntity> entityList = this.selectList(queryWrapper);
        Set<String> result = entityList.stream().map(x -> x.getUniqueKey()).collect(Collectors.toSet());
        return result;
    }
}
