package shop.alien.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.SportsEquipmentFacility;

/**
 * 运动器材设施 Mapper 接口
 *
 * @author system
 * @since 2025-01-XX
 */
@Mapper
public interface SportsEquipmentFacilityMapper extends BaseMapper<SportsEquipmentFacility> {

    /**
     * 根据设备ID查询设施记录（包括已删除的记录，绕过逻辑删除）
     *
     * @param equipmentId 设备ID（fitness_equipment_info表的主键ID）
     * @return 设施记录列表
     */
    @Select("SELECT * FROM sports_equipment_facility WHERE fitness_equipment_ids LIKE CONCAT('%', #{equipmentId}, '%') ORDER BY created_time DESC LIMIT 1")
    SportsEquipmentFacility selectByEquipmentIdIncludeDeleted(@Param("equipmentId") Integer equipmentId);
}

