Commit 9fa82840 authored by root's avatar root
Browse files

removendo variaveis desnecessarias do alunoService

parent 1e73ad0b
Showing with 8 additions and 16 deletions
+8 -16
......@@ -52,8 +52,8 @@ public class AlunoController {
public ResponseEntity<Page<AlunoDTO>> findByAnyWord(@RequestParam("palavra") String palavra,
@RequestParam(value = "page", required = false, defaultValue = "10") int page,
@RequestParam(value = "size",required = false, defaultValue = "10") int size ) {
String wordLowerCase = palavra.toLowerCase();
return ResponseEntity.ok().body(alunoService.findByAnyWord(wordLowerCase, page, size));
return ResponseEntity.ok().body(alunoService.findByAnyWord(palavra.toLowerCase(), page, size));
}
@PutMapping(consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
......
......@@ -44,15 +44,11 @@ public class AlunoService {
public Page<AlunoDTO> findAll() {
int page = 0;
int size = 10;
List<AlunoDTO> alunosDto = alunoMapper.toDto((List<Aluno>) alunoRepository.findAll());
PageRequest pageRequest = PageRequest.of(
page,
size,
Sort.Direction.ASC,
"name");
PageRequest pageRequest = PageRequest.of(page, size, Sort.Direction.ASC, "name");
return new PageImpl<>(
alunosDto ,
alunoMapper.toDto((List<Aluno>) alunoRepository.findAll()) ,
pageRequest, size);
//return alunoMapper.toDto(alunoRepository.findAll());
}
......@@ -95,14 +91,10 @@ public class AlunoService {
throw new EntityNotFoundException("Aluno não encontrado.");
}
PageRequest pageRequest = PageRequest.of(
page,
size,
Sort.Direction.ASC,
"name");
List<AlunoDTO> alunosDto = alunoMapper.toDto(response.get().stream().collect(Collectors.toList()));
PageRequest pageRequest = PageRequest.of( page, size, Sort.Direction.ASC, "name");
return new PageImpl<>(
alunosDto,
alunoMapper.toDto(response.get().stream().collect(Collectors.toList())),
pageRequest, size);
//return alunoMapper.toDto(response.get());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment