package com.fs.store.mapper;

import java.util.List;
import com.fs.store.domain.FsStoreActivity;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 活动Mapper接口
 * 
 * @author fs
 * @date 2022-11-18
 */
public interface FsStoreActivityMapper 
{
    /**
     * 查询活动
     * 
     * @param activityId 活动ID
     * @return 活动
     */
    public FsStoreActivity selectFsStoreActivityById(Long activityId);

    /**
     * 查询活动列表
     * 
     * @param fsStoreActivity 活动
     * @return 活动集合
     */
    public List<FsStoreActivity> selectFsStoreActivityList(FsStoreActivity fsStoreActivity);

    /**
     * 新增活动
     * 
     * @param fsStoreActivity 活动
     * @return 结果
     */
    public int insertFsStoreActivity(FsStoreActivity fsStoreActivity);

    /**
     * 修改活动
     * 
     * @param fsStoreActivity 活动
     * @return 结果
     */
    public int updateFsStoreActivity(FsStoreActivity fsStoreActivity);

    /**
     * 删除活动
     * 
     * @param activityId 活动ID
     * @return 结果
     */
    public int deleteFsStoreActivityById(Long activityId);

    /**
     * 批量删除活动
     * 
     * @param activityIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteFsStoreActivityByIds(Long[] activityIds);
    @Select("select * from fs_store_activity where status=1 order by activity_id desc limit 1")
    FsStoreActivity selectFsStoreActivityByTop();

    @Update("update fs_store_activity set share_number=share_number+1 where activity_id=#{activityId} ")
    int addShare(Long activityId);
}
