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

import cn.novalon.gym.manage.db.entity.SysNoticeEntity;
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 SysNoticeDao extends R2dbcRepository<SysNoticeEntity, Long> {

    Flux<SysNoticeEntity> findByStatusAndDeletedAtIsNull(String status);

    Flux<SysNoticeEntity> findByStatusAndDeletedAtIsNull(String status, Sort sort);

    Flux<SysNoticeEntity> findByDeletedAtIsNull();

    Flux<SysNoticeEntity> findByDeletedAtIsNull(Sort sort);

    Mono<Long> countByDeletedAtIsNull();

    Mono<Void> deleteByIdAndDeletedAtIsNull(Long id);
}
