package com.haha.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.haha.entity.ActivityShop;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ActivityShopMapper extends BaseMapper<ActivityShop> {

    @Select("SELECT shop_id FROM t_activity_shop WHERE activity_id = #{activityId}")
    List<Long> selectShopIdsByActivityId(@Param("activityId") Long activityId);

    @Delete("DELETE FROM t_activity_shop WHERE activity_id = #{activityId}")
    int deleteByActivityId(@Param("activityId") Long activityId);

    @Select("SELECT activity_id FROM t_activity_shop WHERE shop_id = #{shopId}")
    List<Long> selectActivityIdsByShopId(@Param("shopId") Long shopId);
}
