package cn.novalon.manage.db.dao;

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

    Mono<SysConfigEntity> findByConfigKeyAndDeletedAtIsNull(String configKey);

    Flux<SysConfigEntity> findByDeletedAtIsNull();

    Flux<SysConfigEntity> findByDeletedAtIsNull(Sort sort);

    Mono<Long> countByDeletedAtIsNull();

    Mono<Void> deleteByIdAndDeletedAtIsNull(Long id);
}
