package org.jeecg.modules.system.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.app.dto.SearchDTO;
import org.jeecg.modules.app.vo.SearchVO;
import org.jeecg.modules.app.vo.game.FindByGameIdPriceVo;
import org.jeecg.modules.app.vo.game.FindByIdResponse;
import org.jeecg.modules.app.vo.game.FindPagResponse;
import org.jeecg.modules.system.app.dto.AppGameDTO;
import org.jeecg.modules.system.app.dto.AppGamePageDTO;
import org.jeecg.modules.system.app.dto.ExportConditionDTO;
import org.jeecg.modules.system.app.entity.AppGame;
import org.jeecg.modules.system.app.vo.ExportConditionOutVO;

import java.io.File;
import java.util.List;

/**
 * @Description: 赛事表
 * @Author: jeecg-boot
 * @Date:   2025-07-03
 * @Version: V1.0
 */
public interface AppGameMapper extends BaseMapper<AppGame> {
    /**
     * @Author SheepHy
     * @Description 赛事分页查询
     * @Date 14:04 2025/7/7
     * @Param searchDTO {@link SearchDTO}
     * @return Page<SearchVO.SearchRaceVO>
     **/
    Page<SearchVO.SearchRaceVO> convertSearchCompetitionVOPage(@Param("page")Page<SearchVO.SearchRaceVO> page,@Param("searchDTO")SearchDTO searchDTO);

    IPage<AppGameDTO> findPage(@Param("page")Page<AppGame> page, @Param("appGamePageDTO")AppGamePageDTO appGamePageDTO);

    IPage<FindPagResponse> findConcerts(@Param("page") Page<FindPagResponse> page,@Param("longitude")  double longitude,@Param("latitude")  double latitude);


    FindByIdResponse findById(@Param("id") String id,@Param("longitude")  double longitude,@Param("latitude")  double latitude);

    FindByGameIdPriceVo findByGameId(@Param("id") String id);


    @Select("SELECT a.*, " +
            "(SELECT sd.depart_name FROM sys_depart sd WHERE sd.org_code = c.org_code) AS siteAddress " +
            "FROM nm_game a " +
            "LEFT JOIN nm_site c ON a.site_id = c.id " +
            "LEFT JOIN nm_game_price_rules b ON a.id = b.game_id AND b.del_flag = 0 " +
            "WHERE b.id = #{priceRulesId}")
    AppGame  findByPriceRules(@Param("priceRulesId") String priceRulesId);

    /**
     * @description 赛事条件导出
     * params
     * @author SheepHy
     * @date 2025/9/17
     * return   {@link }
     **/
    List<ExportConditionOutVO> exportCondition(@Param("exportConditionDTO")ExportConditionDTO exportConditionDTO);
}
