VideoPoolDao.java
1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package cn.fw.freya.dao;
import cn.fw.freya.model.data.pool.VideoPool;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* 视频处理
*
* @author kurisu
*/
@Repository
public interface VideoPoolDao extends JpaRepository<VideoPool, Long> {
/**
* 删除
*
* @param accountNo 账户号
* @param previousDay 前一天
* @param type 账户类型
* @param resourceType 资源类型
*/
@Transactional(rollbackFor = Exception.class)
@Modifying
@Query("delete from VideoPool where accountNo = ?1 and reportDate = ?2 and type=?3 and resourceType=?4")
void deleteByAccountNoAndDate(String accountNo, Date previousDay, Integer type, Integer resourceType);
/**
* 获取今天上报的数据
*
* @param accountNo 账户号
* @param type 账户类型
* @param reportDate 上报日期
* @return
*/
@Query("select v from VideoPool v where v.accountNo = ?1 and v.type = ?2 and v.reportDate >= ?3")
List<VideoPool> getHasReportDate(String accountNo, Integer type, Date reportDate);
}