Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Eduardo Andre Soares
Ficai-4.0 Backend
Commits
9fa82840
Commit
9fa82840
authored
2 years ago
by
root
Browse files
Options
Download
Email Patches
Plain Diff
removendo variaveis desnecessarias do alunoService
parent
1e73ad0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/com/ficai4/backend/controller/AlunoController.java
+2
-2
...n/java/com/ficai4/backend/controller/AlunoController.java
src/main/java/com/ficai4/backend/service/AlunoService.java
+6
-14
src/main/java/com/ficai4/backend/service/AlunoService.java
with
8 additions
and
16 deletions
+8
-16
src/main/java/com/ficai4/backend/controller/AlunoController.java
View file @
9fa82840
...
...
@@ -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
(
word
LowerCase
,
page
,
size
));
return
ResponseEntity
.
ok
().
body
(
alunoService
.
findByAnyWord
(
palavra
.
to
LowerCase
()
,
page
,
size
));
}
@PutMapping
(
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/ficai4/backend/service/AlunoService.java
View file @
9fa82840
...
...
@@ -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
<>(
aluno
sDto
,
aluno
Mapper
.
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
<>(
aluno
sDto
,
aluno
Mapper
.
toDto
(
response
.
get
().
stream
().
collect
(
Collectors
.
toList
()))
,
pageRequest
,
size
);
//return alunoMapper.toDto(response.get());
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help