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
package common.repository;
import common.model.Contract;
import common.model.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigInteger;
import java.util.List;
@Transactional
public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query(value="select count(*) from contract where ds = ?1",nativeQuery=true)
BigInteger countNumByDs(String ds);
@Query(value="select count(*) from contract where email = ?1 and platform = ?2",nativeQuery=true)
BigInteger countNumByEmail(String email, String platfrom);
@Query(value="select * from contract where ds >= ?1 and ds <= ?2 and platform = ?3 order by ds desc",nativeQuery=true)
List<Contract> findByDs(String startDate, String endDate, String platfrom);
@Query(value="select * from contract where contract_code = ?1",nativeQuery=true)
Contract findByCode(String contract_code);
@Query(value="SELECT * from contract where platform = ?1",nativeQuery=true)
List<Contract> findByPlatform(String platform);
@Query(value="SELECT * from contract where platform = ?1 and email = ?2",nativeQuery=true)
List<Contract> findByPlatformAndEmail(String platform, String email);
@Query(value="SELECT * from contract where start_date = ?1 and status <> 'cancel'",nativeQuery=true)
List<Contract> findByStartDate(String startDate);
@Query(value="SELECT * from contract where end_date <= ?1 and (status <> 'end' or status <> 'cancel')",nativeQuery=true)
List<Contract> findByEndDate(String endDate);
}