-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b34010
commit 0ab130c
Showing
20 changed files
with
334 additions
and
59 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/main/java/com/medcontrol/medcontrol/controller/DepartamentoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/medcontrol/medcontrol/controller/EstoqueController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/medcontrol/medcontrol/controller/FuncionarioController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/medcontrol/medcontrol/controller/MedicamentoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/medcontrol/medcontrol/controller/TransacaoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 0 additions & 53 deletions
53
src/main/java/com/medcontrol/medcontrol/controller/UnidadeDeTrabalhoController.java
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
src/main/java/com/medcontrol/medcontrol/controller/UnidadeTrabalhoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.medcontrol.medcontrol.controller; | ||
|
||
import com.medcontrol.medcontrol.model.UnidadeTrabalhoModel; | ||
import com.medcontrol.medcontrol.service.UnidadeTrabalhoService; | ||
import com.medcontrol.service.UnidadeDeTrabalhoService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/api/unidades-de-trabalho") | ||
public class UnidadeTrabalhoController { | ||
|
||
private final UnidadeTrabalhoService unidadeDeTrabalhoService; | ||
|
||
@Autowired | ||
public UnidadeTrabalhoController(UnidadeTrabalhoService unidadeDeTrabalhoService) { | ||
this.unidadeDeTrabalhoService = unidadeDeTrabalhoService; | ||
} | ||
|
||
@GetMapping | ||
public ResponseEntity<Page<UnidadeTrabalhoModel>> getAllUnidadesDeTrabalho(Pageable pageable) { | ||
Page<UnidadeTrabalhoModel> unidadesDeTrabalho = unidadeDeTrabalhoService.getAllUnidadesDeTrabalho(pageable); | ||
return ResponseEntity.ok(unidadesDeTrabalho); | ||
} | ||
|
||
@GetMapping("/{id}") | ||
public ResponseEntity<UnidadeTrabalhoModel> getUnidadeDeTrabalhoById(@PathVariable Long id) { | ||
UnidadeTrabalhoModel unidadeDeTrabalho = unidadeDeTrabalhoService.getUnidadeDeTrabalhoById(id); | ||
return ResponseEntity.ok(unidadeDeTrabalho); | ||
} | ||
|
||
@PostMapping | ||
public ResponseEntity<UnidadeTrabalhoModel> createUnidadeDeTrabalho(@Validated @RequestBody UnidadeTrabalhoModel unidadeTrabalhoModel) { | ||
UnidadeTrabalhoModel createdUnidadeDeTrabalho = unidadeDeTrabalhoService.createUnidadeDeTrabalho(unidadeTrabalhoModel); | ||
return ResponseEntity.ok(createdUnidadeDeTrabalho); | ||
} | ||
|
||
@PutMapping("/{id}") | ||
public ResponseEntity<UnidadeTrabalhoModel> updateUnidadeDeTrabalho(@PathVariable Long id, @Validated @RequestBody UnidadeTrabalhoModel unidadeTrabalhoModel) { | ||
UnidadeTrabalhoModel updatedUnidadeDeTrabalho = unidadeDeTrabalhoService.updateUnidadeDeTrabalho(id, unidadeTrabalhoModel); | ||
return ResponseEntity.ok(updatedUnidadeDeTrabalho); | ||
} | ||
|
||
@DeleteMapping("/{id}") | ||
public ResponseEntity<Void> deleteUnidadeDeTrabalho(@PathVariable Long id) { | ||
unidadeDeTrabalhoService.deleteUnidadeDeTrabalho(id); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/com/medcontrol/medcontrol/repository/DepartamentoRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.medcontrol.medcontrol.repository; | ||
|
||
import com.medcontrol.medcontrol.model.DepartamentoModel; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface DepartamentoRepository extends JpaRepository<DepartamentoModel, Long> { | ||
// Adicione métodos personalizados do repositório, se necessário | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/medcontrol/medcontrol/repository/EstoqueRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.medcontrol.medcontrol.repository; | ||
|
||
import com.medcontrol.medcontrol.model.EstoqueModel; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface EstoqueRepository extends JpaRepository<EstoqueModel, Long> { | ||
// Métodos específicos, se necessário | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/medcontrol/medcontrol/repository/FuncionarioRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.medcontrol.medcontrol.repository; | ||
|
||
import com.medcontrol.medcontrol.model.FuncionarioModel; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface FuncionarioRepository extends JpaRepository<FuncionarioModel, Long> { | ||
// Métodos específicos, se necessário | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/medcontrol/medcontrol/repository/MedicamentoRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.medcontrol.medcontrol.repository; | ||
import com.medcontrol.medcontrol.model.MedicamentoModel; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface MedicamentoRepository extends JpaRepository<MedicamentoModel, Long> { | ||
// Métodos específicos, se necessário | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/medcontrol/medcontrol/repository/TransacaoRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.medcontrol.medcontrol.repository; | ||
|
||
import com.medcontrol.medcontrol.model.TransacaoModel; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface TransacaoRepository extends JpaRepository<TransacaoModel, Long> { | ||
// Métodos específicos, se necessário | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/medcontrol/medcontrol/repository/UnidadeTrabalhoRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.medcontrol.medcontrol.repository; | ||
|
||
import com.medcontrol.medcontrol.model.UnidadeTrabalhoModel; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface UnidadeTrabalhoRepository extends JpaRepository<UnidadeTrabalhoModel, Long> { | ||
// Adicione métodos personalizados do repositório, se necessário | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/medcontrol/medcontrol/service/DepartamentoService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.medcontrol.medcontrol.service; | ||
|
||
import com.medcontrol.medcontrol.model.DepartamentoModel; | ||
import com.medcontrol.medcontrol.repository.DepartamentoRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Service | ||
public class DepartamentoService { | ||
private final DepartamentoRepository departamentoRepository; | ||
|
||
@Autowired | ||
public DepartamentoService(DepartamentoRepository departamentoRepository) { | ||
this.departamentoRepository = departamentoRepository; | ||
} | ||
|
||
public List<DepartamentoModel> getAllDepartamentos() { | ||
return departamentoRepository.findAll(); | ||
} | ||
|
||
public Optional<DepartamentoModel> getDepartamentoById(Long id) { | ||
return departamentoRepository.findById(id); | ||
} | ||
|
||
public DepartamentoModel saveDepartamento(DepartamentoModel departamento) { | ||
// Lógica de validação e processamento, se necessário | ||
return departamentoRepository.save(departamento); | ||
} | ||
|
||
public void deleteDepartamento(Long id) { | ||
departamentoRepository.deleteById(id); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/medcontrol/medcontrol/service/EstoqueService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.medcontrol.medcontrol.service; | ||
|
||
import com.medcontrol.medcontrol.model.EstoqueModel; | ||
import com.medcontrol.medcontrol.repository.EstoqueRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Service | ||
public class EstoqueService { | ||
private final EstoqueRepository estoqueRepository; | ||
|
||
@Autowired | ||
public EstoqueService(EstoqueRepository estoqueRepository) { | ||
this.estoqueRepository = estoqueRepository; | ||
} | ||
|
||
public List<EstoqueModel> getAllEstoques() { | ||
return estoqueRepository.findAll(); | ||
} | ||
|
||
public Optional<EstoqueModel> getEstoqueById(Long id) { | ||
return estoqueRepository.findById(id); | ||
} | ||
|
||
public EstoqueModel saveEstoque(EstoqueModel estoque) { | ||
// Lógica de validação e processamento, se necessário | ||
return estoqueRepository.save(estoque); | ||
} | ||
|
||
public void deleteEstoque(Long id) { | ||
estoqueRepository.deleteById(id); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/medcontrol/medcontrol/service/FuncionarioService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.medcontrol.medcontrol.service; | ||
|
||
import com.medcontrol.medcontrol.model.FuncionarioModel; | ||
import com.medcontrol.medcontrol.repository.FuncionarioRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Service | ||
public class FuncionarioService { | ||
private final FuncionarioRepository funcionarioRepository; | ||
|
||
@Autowired | ||
public FuncionarioService(FuncionarioRepository funcionarioRepository) { | ||
this.funcionarioRepository = funcionarioRepository; | ||
} | ||
|
||
public List<FuncionarioModel> getAllFuncionarios() { | ||
return funcionarioRepository.findAll(); | ||
} | ||
|
||
public Optional<FuncionarioModel> getFuncionarioById(Long id) { | ||
return funcionarioRepository.findById(id); | ||
} | ||
|
||
public FuncionarioModel saveFuncionario(FuncionarioModel funcionario) { | ||
// Lógica de validação e processamento, se necessário | ||
return funcionarioRepository.save(funcionario); | ||
} | ||
|
||
public void deleteFuncionario(Long id) { | ||
funcionarioRepository.deleteById(id); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/medcontrol/medcontrol/service/MedicamentoService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.medcontrol.medcontrol.service; | ||
|
||
import com.medcontrol.medcontrol.model.MedicamentoModel; | ||
import com.medcontrol.medcontrol.repository.MedicamentoRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Service | ||
public class MedicamentoService { | ||
private final MedicamentoRepository medicamentoRepository; | ||
|
||
@Autowired | ||
public MedicamentoService(MedicamentoRepository medicamentoRepository) { | ||
this.medicamentoRepository = medicamentoRepository; | ||
} | ||
|
||
public List<MedicamentoModel> getAllMedicamentos() { | ||
return medicamentoRepository.findAll(); | ||
} | ||
|
||
public Optional<MedicamentoModel> getMedicamentoById(Long id) { | ||
return medicamentoRepository.findById(id); | ||
} | ||
|
||
public MedicamentoModel saveMedicamento(MedicamentoModel medicamento) { | ||
// Lógica de validação e processamento, se necessário | ||
return medicamentoRepository.save(medicamento); | ||
} | ||
|
||
public void deleteMedicamento(Long id) { | ||
medicamentoRepository.deleteById(id); | ||
} | ||
} |
Oops, something went wrong.