package com.fs.store.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.store.mapper.FsStoreCouponMapper;
import com.fs.store.domain.FsStoreCoupon;
import com.fs.store.service.IFsStoreCouponService;

/**
 * 优惠券Service业务层处理
 *
 * @author fs
 * @date 2022-03-15
 */
@Service
public class FsStoreCouponServiceImpl implements IFsStoreCouponService
{
    @Autowired
    private FsStoreCouponMapper fsStoreCouponMapper;

    /**
     * 查询优惠券
     *
     * @param couponId 优惠券ID
     * @return 优惠券
     */
    @Override
    public FsStoreCoupon selectFsStoreCouponById(Long couponId)
    {
        return fsStoreCouponMapper.selectFsStoreCouponById(couponId);
    }

    /**
     * 查询优惠券列表
     *
     * @param fsStoreCoupon 优惠券
     * @return 优惠券
     */
    @Override
    public List<FsStoreCoupon> selectFsStoreCouponList(FsStoreCoupon fsStoreCoupon)
    {
        return fsStoreCouponMapper.selectFsStoreCouponList(fsStoreCoupon);
    }

    /**
     * 新增优惠券
     *
     * @param fsStoreCoupon 优惠券
     * @return 结果
     */
    @Override
    public int insertFsStoreCoupon(FsStoreCoupon fsStoreCoupon)
    {
        fsStoreCoupon.setCreateTime(DateUtils.getNowDate());
        return fsStoreCouponMapper.insertFsStoreCoupon(fsStoreCoupon);
    }

    /**
     * 修改优惠券
     *
     * @param fsStoreCoupon 优惠券
     * @return 结果
     */
    @Override
    public int updateFsStoreCoupon(FsStoreCoupon fsStoreCoupon)
    {
        fsStoreCoupon.setUpdateTime(DateUtils.getNowDate());
        return fsStoreCouponMapper.updateFsStoreCoupon(fsStoreCoupon);
    }

    /**
     * 批量删除优惠券
     *
     * @param couponIds 需要删除的优惠券ID
     * @return 结果
     */
    @Override
    public int deleteFsStoreCouponByIds(Long[] couponIds)
    {
        return fsStoreCouponMapper.deleteFsStoreCouponByIds(couponIds);
    }

    /**
     * 删除优惠券信息
     *
     * @param couponId 优惠券ID
     * @return 结果
     */
    @Override
    public int deleteFsStoreCouponById(Long couponId)
    {
        return fsStoreCouponMapper.deleteFsStoreCouponById(couponId);
    }


    @Override
    public List<FsStoreCoupon> selectFsStoreCouponByIds(String ids) {
        return fsStoreCouponMapper.selectFsStoreCouponByIds(ids);
    }
}
