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
45
46
47
48
/*
package com.reyun.repository;
import com.reyun.model.ThirdAccount;
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 java.util.Date;
import java.util.List;
*/
/**
* Created by sunhao on 17/3/21.
*//*
@Transactional
public interface ThirdAccountRepository extends JpaRepository<ThirdAccount, Long> {
@Query(value = "select * from third_account where account_id = ?1 and channel_unique_name = ?2 and validation is true", nativeQuery = true)
ThirdAccount findValidAccountById(Long accountId,String accountType);
@Query(value = "select * from third_account where account_id = ?1 and channel_unique_name = ?2 and validation is false", nativeQuery = true)
ThirdAccount findInvalidAccountById(Long accountId,String accountType);
@Query(value = "select * from third_account where account_id = ?1 and channel_unique_name = ?2 ", nativeQuery = true)
ThirdAccount findAccountById(Long accountId,String accountType);
@Query(value = "select * from third_account where validation is true", nativeQuery = true)
List<ThirdAccount> findAllValidAccount();
@Transactional
@Modifying
@Query(value = "update third_account set token = ?1 ,refresh_token = ?2 , token_invalid_date = ?3,modify_date = CURRENT_TIMESTAMP(),validation = true where account_id = ?4 and channel_unique_name = ?5 ", nativeQuery = true)
int updateThirdAccountToken(String token, String refreshToken, Date tokenDate, Long accountId,String channelUniqueName);
@Transactional
@Modifying
@Query(value = "update third_account set validation = ?1,modify_date = CURRENT_TIMESTAMP() where id = ?2 and validation is true", nativeQuery = true)
int updateThirdAccountStatus(Boolean status, Long thirdAccountId);
@Transactional
@Modifying
@Query(value = "update third_account set name = ?2,password = ?3,validation = ?4, modify_date = CURRENT_TIMESTAMP() where id = ?1 and validation is false", nativeQuery = true)
int updateThirdAccountNamePwd(Long thirdAccountId,String userName,String password,Boolean validation);
}
*/