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 userio.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import userio.model.DataAuth;
import java.util.List;
@Transactional
public interface IODataAuthRepository extends JpaRepository<DataAuth, Long> {
@Query(value = "select * from data_auth where account in ?1", nativeQuery = true)
List<DataAuth> findDataAuthByAccount(List<Long> account);
@Query(value = "select * from data_auth where account = ?1", nativeQuery = true)
List<DataAuth> findDataAuthByAccount(Long account);
@Query(value = "select * from data_auth where account = ?1 and app=?2", nativeQuery = true)
List<DataAuth> findDataAuthByAccountAndApp(Long account, Long app);
@Query(value = "select * from data_auth where account = ?2 and app in (select app from auth where create_account in ?1 and account = ?2)", nativeQuery = true)
List<DataAuth> findDataAuthByCreateAccount(List<Long> createAccount, Long channelAccount);
@Transactional
@Modifying
@Query(value = "delete from data_auth where account = ?1", nativeQuery = true)
void deleteAuthByAccount(Long account);
@Query(value = "select * from data_auth where app = ?1 and channel =?2 and campaign =?3", nativeQuery = true)
List<DataAuth> listDataAuthByAppChnCam(Long app, Long channel, Long campain);
Iterable<DataAuth> findByApp(Long id);
@Query(value = "select account from data_auth where app = ?1 and channel =?2 and campaign =?3", nativeQuery = true)
List<Long> listAccountByAppChnCam(Long app, Long channel, Long campain);
@Query(value = "select * from data_auth where channel =?1", nativeQuery = true)
List<DataAuth> listDataAuthByChannel(Long channel);
@Query(value = "select * from data_auth where account = ?1 and app = ?2 and all_campaign = 1", nativeQuery = true)
List<DataAuth> listByAllCampaign(Long account, Long app);
}