package com.fs.store.service.impl;

import com.fs.common.utils.DateUtils;
import com.fs.store.domain.FsStoreActivity;
import com.fs.store.mapper.FsStoreActivityMapper;
import com.fs.store.service.IFsStoreActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 活动Service业务层处理
 *
 * @author fs
 * @date 2022-11-18
 */
@Service
public class FsStoreActivityServiceImpl implements IFsStoreActivityService
{
    @Autowired
    private FsStoreActivityMapper fsStoreActivityMapper;

    /**
     * 查询活动
     *
     * @param activityId 活动ID
     * @return 活动
     */
    @Override
    public FsStoreActivity selectFsStoreActivityById(Long activityId)
    {
        return fsStoreActivityMapper.selectFsStoreActivityById(activityId);
    }

    /**
     * 查询活动列表
     *
     * @param fsStoreActivity 活动
     * @return 活动
     */
    @Override
    public List<FsStoreActivity> selectFsStoreActivityList(FsStoreActivity fsStoreActivity)
    {
        return fsStoreActivityMapper.selectFsStoreActivityList(fsStoreActivity);
    }

    /**
     * 新增活动
     *
     * @param fsStoreActivity 活动
     * @return 结果
     */
    @Override
    public int insertFsStoreActivity(FsStoreActivity fsStoreActivity)
    {
        fsStoreActivity.setCreateTime(DateUtils.getNowDate());
        return fsStoreActivityMapper.insertFsStoreActivity(fsStoreActivity);
    }

    /**
     * 修改活动
     *
     * @param fsStoreActivity 活动
     * @return 结果
     */
    @Override
    public int updateFsStoreActivity(FsStoreActivity fsStoreActivity)
    {
        return fsStoreActivityMapper.updateFsStoreActivity(fsStoreActivity);
    }

    /**
     * 批量删除活动
     *
     * @param activityIds 需要删除的活动ID
     * @return 结果
     */
    @Override
    public int deleteFsStoreActivityByIds(Long[] activityIds)
    {
        return fsStoreActivityMapper.deleteFsStoreActivityByIds(activityIds);
    }

    /**
     * 删除活动信息
     *
     * @param activityId 活动ID
     * @return 结果
     */
    @Override
    public int deleteFsStoreActivityById(Long activityId)
    {
        return fsStoreActivityMapper.deleteFsStoreActivityById(activityId);
    }

    @Override
    public FsStoreActivity selectFsStoreActivityByTop() {
        return fsStoreActivityMapper.selectFsStoreActivityByTop();
    }

    @Override
    public int addShare(Long activityId) {
        return fsStoreActivityMapper.addShare(activityId);
    }
}
