CookieDao.java
1.2 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
package cn.fw.freya.dao;
import cn.fw.freya.model.data.FwCookie;
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.List;
/**
* @author kurisu
*/
@Repository
public interface CookieDao extends JpaRepository<FwCookie, Long> {
/**
* 删除账号对应的cookie
*
* @param accountNo 账户号
* @param type 账户类型(1:快手, 2:抖音, 3:懂车帝, 4:Bilibili)
*/
@Transactional
@Modifying
@Query("delete from FwCookie f where f.accountNo = ?1 and f.type = ?2")
void deleteByAccountNoAndType(String accountNo, Integer type);
/**
* 查询账号对应平台的cookie
*
* @param accountNo 账户号
* @param type 账户类型(1:快手, 2:抖音, 3:懂车帝, 4:Bilibili)
* @return
*/
@Query("select f from FwCookie f where f.accountNo = ?1 and f.type = ?2")
List<FwCookie> findByAccountNoAndType(String accountNo, Integer type);
}