package com.td.Dawa.game.comusers.repository;

import com.td.Dawa.common.repository.*;
import com.td.Dawa.game.comusers.pojo.ComUsers;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface ComUsersRepository extends CommonRepository<ComUsers, String> {
    Optional<ComUsers> findByUserId(String userId);

    Optional<ComUsers> findByAddress(String address);

    @Query(value = "SELECT COUNT(*) FROM com_users WHERE TO_DAYS(DATE_FORMAT(create_time,'%y-%m-%d')) = TO_DAYS(NOW())",nativeQuery = true)
    Long newToday();
}
