2025-04-08 18:36:26 +00:00
|
|
|
package com.ieslamar.GestionInventario.services;
|
|
|
|
|
|
|
|
|
|
import com.ieslamar.GestionInventario.entities.Departamento;
|
|
|
|
|
import com.ieslamar.GestionInventario.repos.DepartamentoRepository;
|
|
|
|
|
import com.ieslamar.GestionInventario.repos.UserRepository;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class DepartamentoService {
|
|
|
|
|
private final DepartamentoRepository departamentoRepository;
|
|
|
|
|
|
|
|
|
|
public DepartamentoService(DepartamentoRepository departamentoRepository) {
|
|
|
|
|
this.departamentoRepository = departamentoRepository;
|
|
|
|
|
}
|
|
|
|
|
public List<Departamento> getAllDepartamentos() {
|
|
|
|
|
return departamentoRepository.findAll();
|
|
|
|
|
}
|
2025-04-14 17:30:42 +00:00
|
|
|
|
|
|
|
|
public void registerDepartamento(String nombre) {
|
|
|
|
|
Departamento departamento = new Departamento();
|
|
|
|
|
departamento.setNombre(nombre);
|
|
|
|
|
departamentoRepository.save(departamento);
|
|
|
|
|
}
|
2025-04-08 18:36:26 +00:00
|
|
|
}
|