package cn.novalon.manage.db.dao;

import cn.novalon.manage.db.entity.SysExceptionLogEntity;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.time.LocalDateTime;

@Repository
public interface SysExceptionLogDao extends R2dbcRepository<SysExceptionLogEntity, Long> {

    Flux<SysExceptionLogEntity> findByUsername(String username);

    Flux<SysExceptionLogEntity> findByUsernameOrderByCreateTimeDesc(String username);

    Flux<SysExceptionLogEntity> findByCreateTimeBetweenOrderByCreateTimeDesc(LocalDateTime startTime, LocalDateTime endTime);

    Flux<SysExceptionLogEntity> findAllByOrderByCreateTimeDesc();

    Mono<Long> count();

    Mono<Long> countByUsername(String username);
}
