private MapSqlParameterSource getParametersMap(Malfunction malfunction) { MapSqlParameterSource parameterSource = new MapSqlParameterSource(); parameterSource.addValue(MALFUNCTION_ID.getValue(), malfunction.getMalfunctionId()); parameterSource.addValue(NAME.getValue(), malfunction.getName()); parameterSource.addValue(AUTO.getValue(), malfunction.getAuto()); parameterSource.addValue(DESCRIPTION.getValue(), malfunction.getDescription()); parameterSource.addValue(APPLICATION_ID.getValue(), malfunction.getApplicationId()); return parameterSource; }
@Override public void updateMalfunction(Malfunction malfunction) { LOGGER.info("DAO:Update malfunction by id=" + malfunction.getMalfunctionId().toString()); HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put(MALFUNCTION_ID.getValue(), malfunction.getMalfunctionId()); hashMap.put(NAME.getValue(), malfunction.getName()); hashMap.put(AUTO.getValue(), malfunction.getAuto()); hashMap.put(DESCRIPTION.getValue(), malfunction.getDescription()); namedParameterJdbcTemplate.update(updateMalfunctionById, hashMap); }