package com.ruoyi.mall.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.mall.mapper.BusinessCouponMapper;
import com.ruoyi.mall.domain.BusinessCoupon;
import com.ruoyi.mall.service.IBusinessCouponService;

/**
 * 优惠卷Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-25
 */
@Service
public class BusinessCouponServiceImpl implements IBusinessCouponService 
{
    @Autowired
    private BusinessCouponMapper businessCouponMapper;

    /**
     * 查询优惠卷
     * 
     * @param couponId 优惠卷主键
     * @return 优惠卷
     */
    @Override
    public BusinessCoupon selectBusinessCouponByCouponId(Long couponId)
    {
        return businessCouponMapper.selectBusinessCouponByCouponId(couponId);
    }

    /**
     * 查询优惠卷列表
     * 
     * @param businessCoupon 优惠卷
     * @return 优惠卷
     */
    @Override
    public List<BusinessCoupon> selectBusinessCouponList(BusinessCoupon businessCoupon)
    {
        return businessCouponMapper.selectBusinessCouponList(businessCoupon);
    }

    /**
     * 新增优惠卷
     * 
     * @param businessCoupon 优惠卷
     * @return 结果
     */
    @Override
    public int insertBusinessCoupon(BusinessCoupon businessCoupon)
    {
        businessCoupon.setCreateTime(DateUtils.getNowDate());
        return businessCouponMapper.insertBusinessCoupon(businessCoupon);
    }

    /**
     * 修改优惠卷
     * 
     * @param businessCoupon 优惠卷
     * @return 结果
     */
    @Override
    public int updateBusinessCoupon(BusinessCoupon businessCoupon)
    {
        businessCoupon.setUpdateTime(DateUtils.getNowDate());
        return businessCouponMapper.updateBusinessCoupon(businessCoupon);
    }

    /**
     * 批量删除优惠卷
     * 
     * @param couponIds 需要删除的优惠卷主键
     * @return 结果
     */
    @Override
    public int deleteBusinessCouponByCouponIds(Long[] couponIds)
    {
        return businessCouponMapper.deleteBusinessCouponByCouponIds(couponIds);
    }

    /**
     * 删除优惠卷信息
     * 
     * @param couponId 优惠卷主键
     * @return 结果
     */
    @Override
    public int deleteBusinessCouponByCouponId(Long couponId)
    {
        return businessCouponMapper.deleteBusinessCouponByCouponId(couponId);
    }
}
