package org.dromara.mall.promotion.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.mall.promotion.domain.MallSeckill;
import org.dromara.mall.promotion.domain.vo.MallSeckillVo;

/**
 * 秒杀活动Mapper接口
 *
 * @author pengles
 */
@Mapper
public interface MallSeckillMapper extends BaseMapperPlus<MallSeckill, MallSeckillVo> {

    /**
     * 扣减秒杀库存
     *
     * @param id       秒杀ID
     * @param quantity 扣减数量
     * @return 影响行数
     */
    int reduceStock(@Param("id") Long id, @Param("quantity") Integer quantity);

    /**
     * 恢复秒杀库存
     *
     * @param id       秒杀ID
     * @param quantity 恢复数量
     * @return 影响行数
     */
    int restoreStock(@Param("id") Long id, @Param("quantity") Integer quantity);

}
