package com.kxs.system.biz.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kxs.system.api.model.KxsCamp;
import com.kxs.system.api.model.KxsCampUser;
import com.kxs.system.api.vo.kxsapp.camp.CampPageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;

/**
 * 训练营(KxsCamp)表数据库访问层
 *
 * @author 系统
 * @since 2024-04-08 15:44:02
 */
@Mapper
public interface KxsCampMapper extends BaseMapper<KxsCamp> {

    /**
     * APP 创客参与训练营列表
     *
     * @param page   页
     * @param userId 用户 ID
     * @return {@link IPage}<{@link CampPageVO}>
     */
    IPage<CampPageVO> getByPage(Page<CampPageVO> page, @Param("userId") Long userId);

    /**
     * 判断创客是否已在其他训练营
     *
     * @param userId 用户 ID
     * @param now 当前时间
     * @return {@link KxsCampUser}
     */
    KxsCampUser selectByUserId(@Param("userId") Integer userId, @Param("now") LocalDateTime now);

    KxsCamp selectUserCamp(@Param("userId") Integer userId, @Param("now") LocalDateTime now);

    KxsCampUser selectUsersCamp(@Param("pids") String[] pids, LocalDateTime now);
}

