@Override public int insertBrandsVehicule(Vehicule vehicule) throws StramException { int result = 0; try { brandsVehiculeMapper.insertBrandsVehicule(vehicule); result = 1; } catch (Exception e) { logger.error(NOT_INSERT, e); throw new StramException(NOT_INSERT, e); } return result; }
@Override public BrandsVehicule getBrandsVehiculeByName(Vehicule vehicule) throws StramException { BrandsVehicule brandsVehicule = null; String name = vehicule.getModelsVehicule().getBrandsVehicule().getName(); try { if (vehicule.getModelsVehicule().getBrandsVehicule().getName() != null && !vehicule.getModelsVehicule().getBrandsVehicule().getName().isEmpty()) { String bn = "%" + vehicule.getModelsVehicule().getBrandsVehicule().getName() + "%"; vehicule.getModelsVehicule().getBrandsVehicule().setName(bn); } brandsVehicule = brandsVehiculeMapper.findByName(vehicule); vehicule.getModelsVehicule().getBrandsVehicule().setName(name); if (brandsVehicule != null) { vehicule.getModelsVehicule().setBrandsVehicule(brandsVehicule); } } catch (Exception e) { logger.error(NOT_DATA_FOUND, e); throw new StramException(NOT_DATA_FOUND, e); } return brandsVehicule; }