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

import cn.novalon.gym.manage.auth.entity.UserEntity;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Mono;

@Repository
public interface UserDao extends R2dbcRepository<UserEntity, Long> {

    @Query("SELECT * FROM sys_user WHERE username = :username AND deleted_at IS NULL")
    Mono<UserEntity> findByUsername(String username);

    @Query("SELECT * FROM sys_user WHERE id = :id AND deleted_at IS NULL")
    Mono<UserEntity> findByIdAndDeletedAtIsNull(Long id);
}