package com.fs.patient.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fs.patient.domain.FsProjectRedPacketRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 理疗红包记录Mapper接口
 * 
 * @author fs
 * @date 2026-04-23
 */
public interface FsProjectRedPacketRecordMapper extends BaseMapper<FsProjectRedPacketRecord>{
    /**
     * 查询理疗红包记录
     * 
     * @param id 理疗红包记录主键
     * @return 理疗红包记录
     */
    FsProjectRedPacketRecord selectFsProjectRedPacketRecordById(Long id);

    /**
     * 查询理疗红包记录列表
     * 
     * @param fsProjectRedPacketRecord 理疗红包记录
     * @return 理疗红包记录集合
     */
    List<FsProjectRedPacketRecord> selectFsProjectRedPacketRecordList(FsProjectRedPacketRecord fsProjectRedPacketRecord);

    /**
     * 新增理疗红包记录
     * 
     * @param fsProjectRedPacketRecord 理疗红包记录
     * @return 结果
     */
    int insertFsProjectRedPacketRecord(FsProjectRedPacketRecord fsProjectRedPacketRecord);

    /**
     * 修改理疗红包记录
     * 
     * @param fsProjectRedPacketRecord 理疗红包记录
     * @return 结果
     */
    int updateFsProjectRedPacketRecord(FsProjectRedPacketRecord fsProjectRedPacketRecord);

    /**
     * 删除理疗红包记录
     * 
     * @param id 理疗红包记录主键
     * @return 结果
     */
    int deleteFsProjectRedPacketRecordById(Long id);

    /**
     * 批量删除理疗红包记录
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int deleteFsProjectRedPacketRecordByIds(Long[] ids);


    FsProjectRedPacketRecord selectTodayFsProjectRedPacketRecordByUserId(Long userId);

    @Select("SELECT * FROM fs_project_red_packet_record WHERE user_id = #{userId} AND project_id = #{projectId} LIMIT 1")
    FsProjectRedPacketRecord selectFsProjectRedPacketByUserIdAndProjectId(@Param("userId") Long userId ,@Param("projectId") Long projectId);

    @Select("SELECT * FROM fs_project_red_packet_record WHERE out_batch_no = #{outBatchNo}")
    FsProjectRedPacketRecord selectFsProjectRedPacketRecordByOutBatchNo(@Param("outBatchNo") String outBatchNo);
}
