source: src/main/java/com/example/baza/service/impl/OcenaServiceImpl.java

Last change on this file was ed20c2c, checked in by HumaSejdini <humasejdini12@…>, 2 years ago

Initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package com.example.baza.service.impl;
2
3import com.example.baza.model.Avtor;
4import com.example.baza.model.Chlen2;
5import com.example.baza.model.Knigi;
6import com.example.baza.model.Ocena;
7import com.example.baza.repository.OcenaRepository;
8import com.example.baza.service.OcenaService;
9import org.springframework.stereotype.Service;
10
11import java.util.List;
12import java.util.Optional;
13
14@Service
15public class OcenaServiceImpl implements OcenaService {
16 private final OcenaRepository ocenaRepository;
17
18 public OcenaServiceImpl(OcenaRepository ocenaRepository) {
19 this.ocenaRepository = ocenaRepository;
20 }
21
22 @Override
23 public Optional<Ocena> findById(Integer id) {
24 return this.ocenaRepository.findById(id);
25 }
26
27 @Override
28 public List<Ocena> findByKomentar(String komentar) {
29 return this.ocenaRepository.findByKomentar(komentar);
30 }
31
32 @Override
33 public Ocena create(Integer ocena, String komentar, Chlen2 chlen, Knigi knigi, Avtor avtor) {
34 return this.ocenaRepository.save(new Ocena(ocena,komentar,chlen,knigi,avtor));
35 }
36
37 @Override
38 public void delete(Integer id) {
39 this.ocenaRepository.deleteById(id);
40 }
41}
Note: See TracBrowser for help on using the repository browser.