Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ordenação default e exibição sql #18

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
Expand All @@ -29,7 +30,7 @@ public void cadastrar(@RequestBody @Valid CadastroMedicoDto dados) {
}

@GetMapping
public Page<DadosListagemMedico> listar(Pageable paginacao) {
public Page<DadosListagemMedico> listar(@PageableDefault(size = 10, sort = {"nome"}) Pageable paginacao) {
return repository.findAll(paginacao)
.map(DadosListagemMedico::new);
}
Expand Down
5 changes: 4 additions & 1 deletion spring-boot-api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/{nome_base_dados}
spring.datasource.username={usuario}
spring.datasource.password={senha}
spring.datasource.password={senha}

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true