package cn.novalon.manage.db.dao;

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

/**
 * 字典数据访问接口
 * 
 * @author 张翔
 * @date 2026-03-13
 */
@Repository
public interface DictionaryDao extends R2dbcRepository<DictionaryEntity, Long> {

    Flux<DictionaryEntity> findByType(String type);

    Mono<DictionaryEntity> findByTypeAndCode(String type, String code);

    Mono<DictionaryEntity> findByTypeAndCodeAndDeletedAtIsNull(String type, String code);

    Flux<DictionaryEntity> findByDeletedAtIsNull();

    Flux<DictionaryEntity> findByDeletedAtIsNullOrderBySortAsc();

    Mono<Void> deleteByIdAndDeletedAtIsNull(Long id);
}