mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-28 14:48:50 +00:00
20 lines
595 B
Java
20 lines
595 B
Java
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 + "'"));
|
|
}
|
|
|
|
}
|