package com.qs.mp.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qs.mp.admin.domain.GoodsCard;
import com.qs.mp.admin.mapper.GoodsCardMapper;
import com.qs.mp.admin.service.IGoodsCardService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qs.mp.common.core.domain.AjaxResult;
import com.qs.mp.common.exception.ServiceException;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 商品卡密关联表 服务实现类
 * </p>
 *
 * @author quanshu
 * @since 2022-08-02
 */
@Service
public class GoodsCardServiceImpl extends ServiceImpl<GoodsCardMapper, GoodsCard> implements IGoodsCardService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void importCard(List<GoodsCard> goodsCardList) {
        boolean rtn = this.saveBatch(goodsCardList);
        if (!rtn) {
            throw new ServiceException("导入失败,请重试");
        }
    }

    @Override
    public List<GoodsCard> listDeliveryOrderItemCardByWrapper(QueryWrapper<GoodsCard> queryWrapper) {
        return getBaseMapper().listDeliveryOrderItemCardByWrapper(queryWrapper);
    }
}
