package com.td.WaDa.game.complayerland.repository;

import com.td.WaDa.common.repository.CommonRepository;
import com.td.WaDa.game.complayerland.pojo.ComPlayerDisasterLog;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ComPlayerDisasterLogRepository extends CommonRepository<ComPlayerDisasterLog, String> {

    /**
     * 获取已发生未读的灾难集合
     * @param userId
     * @return
     */
    @Query(value = "select * from com_player_dsaster_log where user_id = ?1 and `is_show`=0 and `is_enabled`=1",nativeQuery=true)
    List<ComPlayerDisasterLog> getUnShowAndEnabled(String userId);

    ComPlayerDisasterLog findByUserId(String userId);
}
