stats Service and endpoint
todo: statsRepository
This commit is contained in:
@ -2,8 +2,14 @@ package ovh.herisson.Clyde.Repositories.ScientificPublications;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Researcher;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ResearchRepository extends CrudRepository<Research,Long> {
|
||||
|
||||
Research findById(long id);
|
||||
|
||||
Iterable<Research> findByAuthor(Researcher author);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package ovh.herisson.Clyde.Repositories.ScientificPublications;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import ovh.herisson.Clyde.Tables.ScientificPublications.Research;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface StatsRepository extends CrudRepository<Research,Long> {
|
||||
|
||||
@Query("select new map(to_char(r.releaseDate, 'month') as label, sum(r.views) as y) from Research r group by to_char(r.releaseDate, 'month')")
|
||||
Iterable<Map<String ,Integer>> viewsByMonths();
|
||||
|
||||
|
||||
Iterable<Map<String ,Integer>> viewsByYears();
|
||||
Iterable<Map<String ,Integer>> viewsByTopics();
|
||||
Iterable<Map<String ,Integer>> coAuthorByMonths();
|
||||
Iterable<Map<String ,Integer>> coAuthorsByTopics();
|
||||
Iterable<Map<String ,Integer>> languageByTopics();
|
||||
Iterable<Map<String ,Integer>> languageByYears();
|
||||
Iterable<Map<String ,Integer>> languageByMonths();
|
||||
Iterable<Map<String ,Integer>> researchesByYears();
|
||||
Iterable<Map<String ,Integer>> researchesByTopics();
|
||||
Iterable<Map<String ,Integer>> researchesByMonth();
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user