LivePoolDao.java 1.4 KB
package cn.fw.freya.dao;

import cn.fw.freya.model.data.pool.LivePool;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;

/**
 * @author unknown
 * @version 1.0
 * @date 2021/12/13 16:30
 * @Description 直播池
 */
public interface LivePoolDao extends JpaRepository<LivePool, Long> {
    /**
     * 获取今天上报的数据
     *
     * @param accountNo  账户号
     * @param type       账户类型
     * @param reportDate 上报日期
     * @return
     */
    @Query("select live from LivePool live where live.accountNo = ?1 and live.type = ?2 and live.reportDate >= ?3")
    List<LivePool> getHasReportData(String accountNo, Integer type, Date reportDate);

    /**
     * 获取没有拿到回播的直播
     *
     * @param type              账户类型
     * @param durationThreshold 时长阈值
     * @return
     */
    @Query("select live from LivePool live where live.playbackUrl is null and live.roomId is not null and live.type = ?1 and live.duration >= ?2")
    List<LivePool> getWithoutPlaybackLive(Integer type, Double durationThreshold);

    /**
     * 获取没有拿到回播的直播
     *
     * @param accountNo 账户号
     * @return
     */
    @Query("select live from LivePool live where live.accountNo = ?1")
    List<LivePool> getLiveByAccountNo(String accountNo);
}