Changeset d14176d for src/main/java/project/fmo/app/projcetfmo/Repository
- Timestamp:
- 07/07/23 12:14:58 (19 months ago)
- Branches:
- main
- Parents:
- 1dd9226
- Location:
- src/main/java/project/fmo/app/projcetfmo/Repository
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/project/fmo/app/projcetfmo/Repository/AdminRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface AdminRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.apache.catalina.User; 4 import org.springframework.data.domain.Page; 5 import org.springframework.data.domain.Pageable; 6 import org.springframework.data.jpa.repository.JpaRepository; 7 import org.springframework.data.jpa.repository.Query; 8 import project.fmo.app.projcetfmo.Model.AdminKorisnik; 9 10 import java.util.Collection; 11 12 public interface AdminRepository extends JpaRepository<AdminKorisnik, Integer> { 13 2 14 } -
src/main/java/project/fmo/app/projcetfmo/Repository/CenaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface CenaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Cena; 5 import project.fmo.app.projcetfmo.Model.CenaPK; 6 7 public interface CenaRepository extends JpaRepository<Cena, CenaPK> { 8 Cena findByIdProdukt(Integer idProdukt); 9 void deleteByIdProdukt(Integer idProdukt); 2 10 } -
src/main/java/project/fmo/app/projcetfmo/Repository/DostavaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface DostavaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Dostava; 5 import project.fmo.app.projcetfmo.Model.Dostavuvac; 6 7 import java.util.List; 8 9 public interface DostavaRepository extends JpaRepository<Dostava, Integer> { 10 List<Dostava> findByDostavuvacAndStatus(Dostavuvac dostavuvac, String status); 11 List<Dostava> findByStatus(String status); 2 12 } -
src/main/java/project/fmo/app/projcetfmo/Repository/DostavuvacRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface DostavuvacRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Dostavuvac; 5 6 public interface DostavuvacRepository extends JpaRepository<Dostavuvac, Integer> { 2 7 } -
src/main/java/project/fmo/app/projcetfmo/Repository/KategorijaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface KategorijaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Kategorija; 5 6 public interface KategorijaRepository extends JpaRepository<Kategorija, Integer> { 2 7 } -
src/main/java/project/fmo/app/projcetfmo/Repository/KorisnikRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface KorisnikRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import org.springframework.data.jpa.repository.Query; 5 import project.fmo.app.projcetfmo.Model.Korisnik; 6 7 import java.util.List; 8 9 public interface KorisnikRepository extends JpaRepository<Korisnik, Integer> { 10 Korisnik findByImePrezime(String s); 11 Korisnik findByImePrezimeAndPasswordKorisnik(String s, String p); 12 13 @Query(value ="select k.id_korisnik,k.ime_prezime,\n" + 14 "\n" + 15 "(select count(n) from project.naracka as n\n" + 16 "where n.id_korisnik = k.id_korisnik)\n" + 17 "as vkupno_naracki, \n" + 18 "\n" + 19 "(select avg(vkupno_suma) from project.naracka )\n" + 20 "as prosecna_suma_na_naracka_za_site_kupuvaci,\n" + 21 "\n" + 22 "(select sum(n3.vkupno_suma) from project.naracka as n3 \n" + 23 "where k.id_korisnik = n3.id_korisnik) \n" + 24 "as vkupno_suma_od_site_naracki_na_kupuvacot,\n" + 25 "\n" + 26 "(select count(n2) from project.naracka as n2\n" + 27 "where k.id_korisnik = n2.id_korisnik \n" + 28 "and n2.datum between now() - interval '1year' and now() \n" + 29 "and n2.vkupno_suma > (select avg(vkupno_suma) from project.naracka) )\n" + 30 "as vkupno_naracki_nad_prosek_na_korisnikot,\n" + 31 "\n" + 32 "(select sum(n4.vkupno_suma) from project.naracka as n4 \n" + 33 "where k.id_korisnik = n4.id_korisnik \n" + 34 "and n4.datum between now() - interval '1year' and now() \n" + 35 "and n4.vkupno_suma > (select avg(vkupno_suma) from project.naracka) ) \n" + 36 "as vkupno_suma_na_naracki_nad_prosek_za_korisnikot\n" + 37 "\n" + 38 "from project.korisnik as k \n" + 39 "inner join project.kupuvac as k2 on k.id_korisnik = k2.id_korisnik \n" + 40 "group by k.ime_prezime,k.id_korisnik ;" , 41 nativeQuery = true) 42 List<Object> statistics2(); 2 43 } -
src/main/java/project/fmo/app/projcetfmo/Repository/KupuvacRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface KupuvacRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Kupuvac; 5 6 public interface KupuvacRepository extends JpaRepository<Kupuvac, Integer> { 2 7 } -
src/main/java/project/fmo/app/projcetfmo/Repository/NarackaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public class NarackaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Kupuvac; 5 import project.fmo.app.projcetfmo.Model.Naracka; 6 7 public interface NarackaRepository extends JpaRepository<Naracka, Integer> { 8 Naracka findByKupuvacAndStatus(Kupuvac kupuvac, String status); 9 Naracka findByKupuvacAndIdNaracka(Kupuvac kupuvac, Integer idN); 10 Naracka findByKupuvac(Kupuvac k); 11 2 12 } -
src/main/java/project/fmo/app/projcetfmo/Repository/NarackaSodrziProduktRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface NarackaSodrziProduktRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.NarackaSodrziProdukt; 5 import project.fmo.app.projcetfmo.Model.NarackaSodrziProduktPK; 6 7 import javax.persistence.criteria.CriteriaBuilder; 8 import java.util.List; 9 10 public interface NarackaSodrziProduktRepository extends JpaRepository<NarackaSodrziProdukt, NarackaSodrziProduktPK> { 11 NarackaSodrziProdukt findByIdProduktAndIdNaracka(Integer idP, Integer idN); 12 List<NarackaSodrziProdukt> findByIdNaracka(Integer id); 13 void deleteByIdProdukt(Integer id); 14 List<NarackaSodrziProdukt> findByIdProdukt(Integer id); 2 15 } -
src/main/java/project/fmo/app/projcetfmo/Repository/ProduktEOdKategorijaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface ProduktEOdKategorijaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.ProduktEOdKategorija; 5 import project.fmo.app.projcetfmo.Model.ProduktEOdKategorijaPK; 6 7 public interface ProduktEOdKategorijaRepository extends JpaRepository<ProduktEOdKategorija, ProduktEOdKategorijaPK> { 8 ProduktEOdKategorija findByIdProdukt(Integer idProdukt); 9 void deleteByIdProdukt(Integer idProdukt); 10 ProduktEOdKategorija findByIdProduktAndIdKategorija(Integer idProdukt,Integer idKategorija); 2 11 } -
src/main/java/project/fmo/app/projcetfmo/Repository/ProduktRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface ProduktRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.domain.Pageable; 4 import org.springframework.data.jpa.repository.JpaRepository; 5 import org.springframework.data.jpa.repository.Query; 6 import project.fmo.app.projcetfmo.Model.Produkt; 7 8 import java.util.List; 9 10 public interface ProduktRepository extends JpaRepository<Produkt, Integer> { 11 @Query(value = """ 12 select p.id_produkt,p.ime,\s 13 count(nsp) as broj_na_naracki_vo_koi_e_prisuten_produktot,\s 14 sum(nsp.kolicina) as kolicina_prodadeno_od_produktot,\s 15 16 (select avg(n4.vkupno_suma) from project.naracka as n4\s 17 join project.naracka_sodrzi_produkt nsp4 on n4.id_naracka = nsp4.id_naracka \s 18 where n4.id_naracka =nsp4.id_naracka and p.id_produkt = nsp4.id_produkt and n4.datum between now() - interval '3months'\s 19 and now()) 20 as prosecna_suma_na_naracka_vo_koja_se_sodrzi_produktot, 21 22 (select count(n2) from project.naracka as n2\040 23 join project.naracka_sodrzi_produkt nsp2 on n2.id_naracka = nsp2.id_naracka\s 24 where nsp2.id_produkt = p.id_produkt and n2.adresa like '/'\s 25 and n2.datum between now() - interval '3months' and now()) 26 as broj_na_naracki_na_produktot_koi_korisnikot_sam_ke_gi_podigne, 27 28 (select sum(nsp2.kolicina) from project.naracka as n2\s 29 join project.naracka_sodrzi_produkt nsp2 on n2.id_naracka = nsp2.id_naracka\s 30 where nsp2.id_produkt = p.id_produkt and n2.adresa like '/'\s 31 and n2.datum between now() - interval '3months' and now())\s 32 as kolicina_prodadena_na_produktot_bez_dostava, 33 34 (select count(n3) from project.naracka as n3\s 35 join project.naracka_sodrzi_produkt nsp3 on n3.id_naracka = nsp3.id_naracka\s 36 where nsp3.id_produkt = p.id_produkt and n3.adresa not like '/' and n3.datum between now() - interval '3months' and now()) 37 as broj_na_naracki_na_produktot_koi_ke_bidat_dostaveni_na_korisnikot, 38 39 (select sum(nsp3.kolicina) from project.naracka as n3\s 40 join project.naracka_sodrzi_produkt nsp3 on n3.id_naracka = nsp3.id_naracka 41 where nsp3.id_produkt = p.id_produkt and n3.adresa not like '/' and n3.datum between now() - interval '3months' and now()) 42 as kolicina_prodadena_na_produktot_preku_dostava 43 44 from project.produkt as p 45 join project.naracka_sodrzi_produkt as nsp on p.id_produkt = nsp.id_produkt\s 46 join project.naracka as n on nsp.id_naracka = n.id_naracka\s 47 where n.datum between now() - interval '3months' and now() 48 group by p.ime,p.id_produkt;""", 49 nativeQuery = true) 50 List<Object> statistics1(); 51 2 52 } -
src/main/java/project/fmo/app/projcetfmo/Repository/TelefnoskiBrojRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public class TelefnoskiBrojRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Telefonskibroj; 5 import project.fmo.app.projcetfmo.Model.TelefonskibrojPK; 6 7 public interface TelefnoskiBrojRepository extends JpaRepository<Telefonskibroj, TelefonskibrojPK> { 8 2 9 }
Note:
See TracChangeset
for help on using the changeset viewer.