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

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qs.mp.admin.domain.Coupon;
import com.qs.mp.admin.domain.CouponPkgItem;
import com.qs.mp.admin.domain.vo.CouponPkgItemVO;
import com.qs.mp.admin.mapper.CouponPkgItemMapper;
import com.qs.mp.admin.service.ICouponPkgItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 券包明细表 服务实现类
 * </p>
 *
 * @author quanshu
 * @since 2022-04-29
 */
@Service
public class CouponPkgItemServiceImpl extends ServiceImpl<CouponPkgItemMapper, CouponPkgItem> implements ICouponPkgItemService {

    @Override
    public List<CouponPkgItemVO> listDetailByCouponPkgId(Long id) {
        QueryWrapper<CouponPkgItemVO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("t1.coupon_pkg_id", id);
        return this.getBaseMapper().selectDetail(queryWrapper);
    }

    @Override
    public List<Coupon> listCouponByPkgId(String couponPkgId) {
        QueryWrapper<Coupon> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("t1.coupon_pkg_id", couponPkgId);
        return this.getBaseMapper().selectCouponList(queryWrapper);
    }
}
