movidos los ficheros por funciones

This commit is contained in:
Jaime Jiménez
2025-08-06 12:40:08 +02:00
parent a593a1af78
commit a1b8fb01fc
18 changed files with 36 additions and 46 deletions

View File

@ -0,0 +1,19 @@
package com.imprimelibros.erp.configurationERP;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class VariableService {
@Autowired
private VariableRepository variableRepository;
public Integer getValorEntero(String clave) {
return variableRepository.findByClave(clave)
.<Integer>map(v -> Integer.parseInt(v.getValor()))
.orElseThrow(
() -> new IllegalArgumentException("No se encontró la variable con clave '" + clave + "'"));
}
}