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

import cn.novalon.gym.manage.db.entity.SysUserEntity;
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;

/**
 * 用户数据访问接口
 * 
 * @author 张翔
 * @date 2026-03-13
 */
@Repository
public interface SysUserDao extends R2dbcRepository<SysUserEntity, Long> {

    Mono<SysUserEntity> findByUsernameAndDeletedAtIsNull(String username);

    Mono<SysUserEntity> findByEmailAndDeletedAtIsNull(String email);

    Mono<SysUserEntity> findByIdAndDeletedAtIsNull(Long id);

    Flux<SysUserEntity> findAll();

    Flux<SysUserEntity> findAll(Sort sort);

    Flux<SysUserEntity> findByDeletedAtIsNull();

    Flux<SysUserEntity> findByDeletedAtIsNull(Sort sort);

    Mono<Long> countByDeletedAtIsNull();

    Flux<SysUserEntity> findByRoleId(Long roleId);
}