1
1
package ubc .pavlab .rdp .repositories ;
2
2
3
3
import org .springframework .data .jpa .repository .JpaRepository ;
4
+ import org .springframework .data .jpa .repository .Query ;
4
5
import org .springframework .data .jpa .repository .QueryHints ;
6
+ import org .springframework .data .repository .query .Param ;
5
7
import org .springframework .stereotype .Repository ;
6
8
import ubc .pavlab .rdp .model .Taxon ;
7
9
import ubc .pavlab .rdp .model .UserGene ;
14
16
@ Repository
15
17
public interface UserGeneRepository extends JpaRepository <UserGene , Integer > {
16
18
Integer countByTierIn ( Collection <TierType > tiers );
17
- Integer countDistinctGeneByTierIn ( Collection <TierType > tiers );
18
- Integer countDistinctUserByTaxon ( Taxon taxon );
19
+
20
+ @ Query ("select count(distinct geneId) FROM UserGene WHERE tier IN (:tiers)" )
21
+ Integer countDistinctGeneByTierIn ( @ Param ("tiers" ) Collection <TierType > tiers );
22
+
23
+ @ Query ("select count(distinct user) FROM UserGene WHERE taxon = :taxon" )
24
+ Integer countDistinctUserByTaxon ( @ Param ("taxon" ) Taxon taxon );
25
+
26
+ @ Query ("select count(distinct user) FROM UserGene" )
27
+ Integer countDistinctUser ();
19
28
20
29
@ QueryHints (@ QueryHint (name = "org.hibernate.cacheable" , value = "true" ))
21
30
Collection <UserGene > findByGeneId (int geneId );
@@ -24,10 +33,10 @@ public interface UserGeneRepository extends JpaRepository<UserGene, Integer> {
24
33
@ QueryHints (@ QueryHint (name = "org.hibernate.cacheable" , value = "true" ))
25
34
Collection <UserGene > findByGeneIdAndTierIn (int geneId , Set <TierType > tiers );
26
35
@ QueryHints (@ QueryHint (name = "org.hibernate.cacheable" , value = "true" ))
27
- Collection <UserGene > findBySymbolContainingAndTaxon (String symbolContaining , Taxon taxon );
36
+ Collection <UserGene > findBySymbolContainingIgnoreCaseAndTaxon (String symbolContaining , Taxon taxon );
28
37
@ QueryHints (@ QueryHint (name = "org.hibernate.cacheable" , value = "true" ))
29
- Collection <UserGene > findBySymbolContainingAndTaxonAndTier (String symbolContaining , Taxon taxon , TierType tier );
38
+ Collection <UserGene > findBySymbolContainingIgnoreCaseAndTaxonAndTier (String symbolContaining , Taxon taxon , TierType tier );
30
39
@ QueryHints (@ QueryHint (name = "org.hibernate.cacheable" , value = "true" ))
31
- Collection <UserGene > findBySymbolContainingAndTaxonAndTierIn (String symbolContaining , Taxon taxon , Set <TierType > tiers );
40
+ Collection <UserGene > findBySymbolContainingIgnoreCaseAndTaxonAndTierIn (String symbolContaining , Taxon taxon , Set <TierType > tiers );
32
41
33
42
}
0 commit comments