Skip to content

Commit 054c7f6

Browse files
author
andres
committed
Updated Controllers
1 parent 0390b8f commit 054c7f6

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

src/main/java/com/api/rest/microelectronica/controllers/ComponenteCapacitorElectroliticoController.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.api.rest.microelectronica.controllers;
22

3-
import java.util.List;
4-
53
import org.springframework.beans.factory.annotation.Autowired;
64
import org.springframework.data.domain.Page;
75
import org.springframework.data.domain.Pageable;
@@ -52,9 +50,9 @@ public void deleteComponente(@PathVariable("id") int id) {
5250
// ---GET---
5351
// --- LISTADO PAGINADO Y COMPLETO ---
5452
@GetMapping("/listado")
55-
public List<ComponenteCapacitorElectroliticoEntity> getAll(Pageable pageable) {
53+
public Page<ComponenteCapacitorElectroliticoEntity> getAll(Pageable pageable) {
5654

57-
return componenteCapacitorElectroliticoService.getAllCapacitorElectrolitico(pageable);
55+
return componenteCapacitorElectroliticoService.getAll(pageable);
5856
}
5957

6058

src/main/java/com/api/rest/microelectronica/controllers/ComponenteTransistorBipolarController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.api.rest.microelectronica.controllers;
22

3-
import java.util.List;
3+
44

55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.data.domain.Page;
@@ -51,7 +51,7 @@ public boolean deleteComponenteDetalle(@PathVariable("id") int id) {
5151
// ---GET---
5252
// --- LISTADO PAGINADO Y COMPLETO ---
5353
@GetMapping("/listado")
54-
public List<ComponenteTransistorBipolarEntity> getAll(Pageable pageable) {
54+
public Page<ComponenteTransistorBipolarEntity> getAll(Pageable pageable) {
5555

5656
return componenteTransistorBipolarService.getAllComponente(pageable);
5757
}

src/main/java/com/api/rest/microelectronica/services/ComponenteCapacitorElectroliticoService.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.api.rest.microelectronica.services;
22

3-
import java.util.List;
3+
44

55
import org.apache.logging.log4j.Logger;
66
import org.springframework.beans.factory.annotation.Autowired;
@@ -11,8 +11,6 @@
1111
import com.api.rest.microelectronica.entities.ComponenteCapacitorElectroliticoEntity;
1212
import com.api.rest.microelectronica.exceptions.capacitor.electrolitico.CapacitorElectroliticoIdMismatchException;
1313
import com.api.rest.microelectronica.exceptions.capacitor.electrolitico.CapacitorElectroliticoNotFoundException;
14-
import com.api.rest.microelectronica.exceptions.componentes.detalles.ComponenteDetalleIdMismatchException;
15-
import com.api.rest.microelectronica.exceptions.componentes.detalles.ComponenteDetalleNotFoundException;
1614
import com.api.rest.microelectronica.repositories.I_ComponenteCapacitorElectroliticoRepository;
1715

1816
@Service
@@ -96,9 +94,9 @@ public void deleteCapacitorElectrolitico(int id) {
9694
// ===================
9795

9896
// ------- LISTADO PAGINADO ---------
99-
public List<ComponenteCapacitorElectroliticoEntity> getAllCapacitorElectrolitico(Pageable pageable) {
97+
public Page<ComponenteCapacitorElectroliticoEntity> getAll(Pageable pageable) {
10098

101-
return iCapacitorElectroliticoRepository.findAll(pageable).getContent();
99+
return iCapacitorElectroliticoRepository.findAll(pageable);
102100
}
103101

104102
// =============== MÉTODOS DE BUSQUEDA ====================

src/main/java/com/api/rest/microelectronica/services/ComponenteTransistorBipolarService.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.api.rest.microelectronica.services;
22

3-
import java.util.List;
3+
44

55
import org.apache.logging.log4j.Logger;
66
import org.springframework.beans.factory.annotation.Autowired;
@@ -75,18 +75,12 @@ public boolean deleteComponente(int id) {
7575
}
7676
}
7777

78-
// ------ SELECT --------
79-
//------- LISTADO COMPLETO ---------
80-
public List<ComponenteTransistorBipolarEntity> getAllComponente() {
81-
82-
return iTransistorBipolarRepository.findAll();
83-
}
8478

8579
// ------ SELECT --------
8680
//------- LISTADO PAGINADO ---------
87-
public List<ComponenteTransistorBipolarEntity> getAllComponente(Pageable pageable) {
81+
public Page<ComponenteTransistorBipolarEntity> getAllComponente(Pageable pageable) {
8882

89-
return iTransistorBipolarRepository.findAll(pageable).getContent();
83+
return iTransistorBipolarRepository.findAll(pageable);
9084
}
9185

9286
// =============== MÉTODOS DE BUSQUEDA ====================

0 commit comments

Comments
 (0)