package com.sunyard.chsm.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sunyard.chsm.model.entity.CryptoServiceApi;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.util.CollectionUtils;

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

/**
 * @author liulu
 * @since 2024/10/15
 */
@Mapper
public interface CryptoServiceApiMapper extends BaseMapper<CryptoServiceApi> {

    default List<CryptoServiceApi> selectByServiceIds(List<Long> serviceIds) {
        if (CollectionUtils.isEmpty(serviceIds)) {
            return Collections.emptyList();
        }
        return selectList(
                new LambdaQueryWrapper<CryptoServiceApi>()
                        .in(CryptoServiceApi::getCryptoServiceId, serviceIds)
        );
    }


}

