package com.ruoyi.ss.card.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ss.card.mapper.SsCardMapper;
import com.ruoyi.ss.card.domain.SsCard;
import com.ruoyi.ss.card.domain.SsCardVO;
import com.ruoyi.ss.card.domain.SsCardQuery;
import com.ruoyi.ss.card.service.ISsCardService;

/**
 * 卡券Service业务层处理
 *
 * @author qzz
 * @date 2025-03-03
 */
@Service
public class SsCardServiceImpl implements ISsCardService
{
    @Autowired
    private SsCardMapper ssCardMapper;

    /**
     * 查询卡券
     *
     * @param couponId 卡券主键
     * @return 卡券
     */
    @Override
    public SsCardVO selectSsCardByCouponId(Long couponId)
    {
        return ssCardMapper.selectSsCardByCouponId(couponId);
    }

    /**
     * 查询卡券列表
     *
     * @param ssCard 卡券
     * @return 卡券
     */
    @Override
    public List<SsCardVO> selectSsCardList(SsCardQuery ssCard)
    {
        return ssCardMapper.selectSsCardList(ssCard);
    }

    /**
     * 新增卡券
     *
     * @param ssCard 卡券
     * @return 结果
     */
    @Override
    public int insertSsCard(SsCard ssCard)
    {
        ssCard.setCreateTime(DateUtils.getNowDate());
        return ssCardMapper.insertSsCard(ssCard);
    }

    /**
     * 修改卡券
     *
     * @param ssCard 卡券
     * @return 结果
     */
    @Override
    public int updateSsCard(SsCard ssCard)
    {
        return ssCardMapper.updateSsCard(ssCard);
    }

    /**
     * 批量删除卡券
     *
     * @param couponIds 需要删除的卡券主键
     * @return 结果
     */
    @Override
    public int deleteSsCardByCouponIds(Long[] couponIds)
    {
        return ssCardMapper.deleteSsCardByCouponIds(couponIds);
    }

    /**
     * 删除卡券信息
     *
     * @param couponId 卡券主键
     * @return 结果
     */
    @Override
    public int deleteSsCardByCouponId(Long couponId)
    {
        return ssCardMapper.deleteSsCardByCouponId(couponId);
    }
}
