Ignore:
Timestamp:
01/18/22 17:18:17 (3 years ago)
Author:
Test <matonikolov77@…>
Branches:
main
Children:
e0ef1b1
Parents:
7fafead
Message:

Model-database resolved bugs for mapping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java

    r7fafead r3ded84d  
    11package com.wediscussmovies.project.service.impl;
    22
    3 import com.wediscussmovies.project.model.Person;
     3import com.wediscussmovies.project.model.*;
    44import com.wediscussmovies.project.model.enumerations.PersonType;
    55import com.wediscussmovies.project.repository.PersonRepository;
     
    2121    @Override
    2222    public List<Person> findAllDirectors() {
    23         return personRepository.findAllByPersonType(PersonType.D);
     23        return personRepository.findAllByType('D');
    2424    }
    2525
    2626    @Override
    2727    public Optional<Person> findActorById(Integer id) {
    28         return personRepository.findPersonByPerson_idAndPersonType(id, PersonType.A);
     28        return personRepository.findPersonByPersonIdAndType(id, 'A');
    2929    }
    3030
     
    3636    @Override
    3737    public Optional<Person> findDirectorById(Integer id) {
    38         return personRepository.findPersonByPerson_idAndPersonType(id, PersonType.D);
     38        return personRepository.findPersonByPersonIdAndType(id, 'D');
    3939    }
    4040
    4141    @Override
    4242    public List<Person> findAllActors() {
    43         return personRepository.findAllByPersonType(PersonType.A);
     43        return personRepository.findAllByType('A');
    4444    }
    4545
     
    5454    @Override
    5555    public List<Person> findActorsByNameLike(String name) {
    56         return personRepository.findAllByPersonTypeAndNameLike(PersonType.A, name);
     56        return personRepository.findAllByTypeAndNameLike('A', name);
    5757    }
    5858
    5959    @Override
    6060    public List<Person> findActorsBySurnameLike(String surname) {
    61         return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.A, surname);
     61        return personRepository.findAllByTypeAndSurnameLike('A', surname);
    6262    }
    6363
    6464    @Override
    6565    public List<Person> findDirectorsByNameLike(String name) {
    66         return personRepository.findAllByPersonTypeAndNameLike(PersonType.D, name);
     66        return personRepository.findAllByTypeAndNameLike('D', name);
    6767    }
    6868
    6969    @Override
    7070    public List<Person> findDirectorsBySurnameLike(String surname) {
    71         return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.D, surname);
     71        return personRepository.findAllByTypeAndSurnameLike('D', surname);
    7272    }
    7373}
Note: See TracChangeset for help on using the changeset viewer.