package com.nokia.tsl_data.dao;

import com.nokia.tsl_data.entity.UserCount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserCountRepository extends JpaRepository<UserCount, Long> {

    @Query("select e from UserCount e where e.monthId = :month and e.cityName = :city")
    UserCount findByMonthAndCity(@Param("month") String month, @Param("city") String city);

    /**
     * 按月查询客户端用户数
     */
    @Query("select t from UserCount t where t.monthId = :monthId")
    List<UserCount> selectUserCountForMonth(@Param("monthId") String monthId);

}
