package cn.novalon.gym.manage.db.dao;

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

@Repository
public interface SysFileDao extends R2dbcRepository<SysFileEntity, Long> {

    Flux<SysFileEntity> findByCreateBy(String createBy);

    Flux<SysFileEntity> findByCreateBy(String createBy, Sort sort);

    Flux<SysFileEntity> findByCreateByOrderByCreatedAtDesc(String createBy);

    Flux<SysFileEntity> findByDeletedAtIsNull();

    Flux<SysFileEntity> findByDeletedAtIsNull(Sort sort);

    Flux<SysFileEntity> findByDeletedAtIsNullOrderByCreatedAtDesc();

    Mono<Long> countByDeletedAtIsNull();

    Mono<Void> deleteByIdAndDeletedAtIsNull(Long id);

    Flux<SysFileEntity> findByFilePathContaining(String fileName);
}
