ChannelRepository.java 602 Bytes
package tkio.repository;


import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import tkio.model.Channel;

import java.math.BigInteger;
import java.util.List;

@Transactional
public interface ChannelRepository extends JpaRepository<Channel, Long> {

    @Query(value = "select count(*) from channel where account  in ?1 and create_time > ?2 and create_time < ?3", nativeQuery = true)
    BigInteger countByAccount(List<Long> accountId, String startDate, String endDate);
}