package com.yc.ship.module.marketing.service.CouponCodeUseRecord;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import com.yc.ship.module.marketing.dal.dataobject.couponCodeUseRecord.CouponCodeUseRecordDO;
import com.yc.ship.module.marketing.dal.mysql.couponCodeUseRecord.CouponCodeUseRecordMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;


/**
 * 优惠券码使用记录 Service 实现类
 *
 * @author lfy
 */
@Service
@Validated
public class CouponCodeUseRecordServiceImpl implements CouponCodeUseRecordService {

    @Resource
    private CouponCodeUseRecordMapper couponCodeUseRecordMapper;

    @Override
    public List<CouponCodeUseRecordDO> getCouponCodeUseRecordListByCodeIds(Collection<Long> couponCodeIds) {
        if (CollUtil.isEmpty(couponCodeIds)) {
            return ListUtil.empty();
        }
        return couponCodeUseRecordMapper.selectList(CouponCodeUseRecordDO::getCouponCodeId, couponCodeIds);
    }
}