package com.willalp.canteen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.willalp.canteen.domain.HsGift;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 礼品登记Mapper接口
 *
 * @author songyu
 * @date 2022-03-03
 */
public interface HsGiftMapper extends BaseMapper<HsGift>
{
    /**
     * 查询礼品登记列表
     *
     * @param hsGift 礼品登记
     * @return 礼品登记集合
     */
    public List<HsGift> selectHsGiftList(HsGift hsGift);

    /**
     * 查询礼品登记列表
     *
     * @param hsGift 礼品登记
     * @return 礼品登记集合
     */
    public List<HsGift> bindingList(HsGift hsGift);

    /**
     *
     * @param code
     * @return
     */
    public List<HsGift> appSelectedHsGiftListByType(@Param("code") String code);

    /**
     * 根据事件查询对应礼品集合
     *
     * @return
     * @param code1
     * @param code2
     */
    List<HsGift> appSelectedHsGiftByEvent(@Param("code1") String code1,@Param("code2") String code2);

    /**
     * 积分兑换检查库存并实时抵扣
     *
     * @param num
     * @param giftId
     * @return
     */
    int checkAndReduceGiftInventory(@Param("num") int num, @Param("giftId") String giftId);
}
