List of usage examples for org.springframework.jdbc.core.namedparam MapSqlParameterSource MapSqlParameterSource
public MapSqlParameterSource()
From source file:Implement.DAO.CommonDAOImpl.java
@Override public AccountSession loginToYouTripper(String username, String password) { password = DigestUtils.md5DigestAsHex(password.getBytes()); simpleJdbcCall = new SimpleJdbcCall(dataSource).withProcedureName("loginToYouTripper"); SqlParameterSource in = new MapSqlParameterSource().addValue("username", username).addValue("password", password);/*from w ww .ja va2 s.c o m*/ Map<String, Object> record = simpleJdbcCall.execute(in); int id = (int) record.get("id"); String name = (String) record.get("name"); int type = (int) record.get("type"); String image = (String) record.get("image"); return new AccountSession(id, name, type, image); }
From source file:org.voltdb.example.springjdbc.ContestantDao.java
public List<ContestantData> findContestant(String code) { MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("code", new SqlParameterValue(Types.VARCHAR, code)); return query(selectSql, params, new ContestantRowMapper()); }
From source file:br.com.asisprojetos.DAO.TBRelatorioDiagnosticoDAO.java
/** * Lista os protocolos para Cod Produto =1 Sped Fiscal , das Matriz e filiais * @param listCodCliente/* w w w . j a v a 2 s. c o m*/ * @param dataIniProc * @param dataFimProc * @return **/ public List<String> getProtocols(List<String> listCodCliente, String dataIniProc, String dataFimProc) { //String dataIniProc="2015-01-01 00:00:00"; //String dataFimProc="2015-02-01 23:59:59"; //String cnpj="12359822000142"; List<String> listProtocols = null; String SQL = "SELECT " + "tp.NUM_PROT " + "FROM " + " SPF_TBITEM_RESULT tr " + " INNER JOIN " + " SPF_TBCTRL_PROCESSO tp " + " ON tr.NUM_PROT=tp.NUM_PROT " + " WHERE " + " tp.COD_PRODUTO= 1 " + " and tp.IS_TRIAL=0 " + " and tp.SITUACAO=4 " + " and tp.IN_ATIVO='A' " + " and ( " + " tp.COD_CLIENTE in ( " + " :codCliente " + " ) " + " ) " + //" and tp.CNPJ=:cnpj " + " and tp.DATA_INIC_PROC>=:dataIniProc " + " and tp.DATA_FIM_PROC<=:dataFimProc " + " GROUP BY " + " tp.NUM_PROT " + " ORDER BY " + " tp.NUM_PROT desc "; MapSqlParameterSource namedParameters = new MapSqlParameterSource(); namedParameters.addValue("codCliente", listCodCliente); namedParameters.addValue("dataIniProc", dataIniProc); namedParameters.addValue("dataFimProc", dataFimProc); //namedParameters.addValue( "cnpj" , cnpj ); try { listProtocols = getNamedParameterJdbcTemplate().queryForList(SQL, namedParameters, String.class); } catch (DataAccessException ex) { logger.error("Erro ao efetuar busca no banco de dados. Message {}", ex); } return listProtocols; }
From source file:org.runway.users.repository.JdbcUserProfileDaoImpl.java
public List<UserProfile> getUserProfile(String userid) { MapSqlParameterSource mapSql = new MapSqlParameterSource(); mapSql.addValue("id", userid); String querySql = "SELECT id, key1, value, em_time from EM_USER_PROFILE where id=:id"; List<UserProfile> profiles = jdbcTemplate.query(querySql, new UserProfileMapper(), mapSql); return profiles; }
From source file:com.mec.DAO.Passport.UserDAO.java
public List<GrantedAuthority> getUserRoles(Integer userID) { SimpleJdbcCall jdbcCall = new SimpleJdbcCall(ds).withCatalogName("SqlSp") .withProcedureName("paRolesGetByIdUsuario").withoutProcedureColumnMetaDataAccess() .declareParameters(new SqlParameter("idAplicacion", Types.INTEGER)) .declareParameters(new SqlParameter("idUsuario", Types.INTEGER)) .declareParameters(new SqlOutParameter("ErrText", Types.VARCHAR)) .returningResultSet("items", new MyRowMapper()); SqlParameterSource in = new MapSqlParameterSource().addValue("idAplicacion", 1).addValue("idUsuario", userID);/*from w w w. j a v a2s . c o m*/ return (List<GrantedAuthority>) jdbcCall.execute(in).entrySet().iterator().next().getValue(); }
From source file:com.github.dbourdette.glass.log.joblog.jdbc.JdbcJobLogStore.java
@Override public Page<JobLog> getLogs(Query query) { String sql = "from " + getTableName(); return getLogs(sql, new MapSqlParameterSource(), query); }
From source file:ru.org.linux.user.UserTagDao.java
/** * ?./*from ww w . ja v a 2s . c om*/ * * @param userId ? * @param tagId * @param isFavorite (true) (false) */ public void deleteTag(int userId, int tagId, boolean isFavorite) { MapSqlParameterSource parameters = new MapSqlParameterSource(); parameters.addValue("user_id", userId); parameters.addValue("tag_id", tagId); parameters.addValue("is_favorite", isFavorite); jdbcTemplate.update( "DELETE FROM user_tags WHERE user_id=:user_id and tag_id=:tag_id and is_favorite=:is_favorite", parameters); }
From source file:airport.database.services.setting.SettingFrontEndDaoImpl.java
@Override public void setSettingFrontEnd(User user, SettingFrontEnd settingFrontEnd) { MapSqlParameterSource mapSqlParameterSource = new MapSqlParameterSource(); mapSqlParameterSource.addValue("checkSettingMusicAirplane", settingFrontEnd.getCheckSettingMusicAirplane()); mapSqlParameterSource.addValue("checkSettingMusicChat", settingFrontEnd.getCheckSettingMusicChat()); mapSqlParameterSource.addValue("checkSettingMusicService", settingFrontEnd.getCheckSettingMusicService()); mapSqlParameterSource.addValue("checkSettingShowClock", settingFrontEnd.getCheckSettingShowClock()); mapSqlParameterSource.addValue("checkSettingShowDispatcherOnline", settingFrontEnd.getCheckSettingShowDispatcherOnline()); mapSqlParameterSource.addValue("checkSettingShowNewMessage", settingFrontEnd.getCheckSettingShowNewMessage()); mapSqlParameterSource.addValue("checkSettingShowProfile", settingFrontEnd.getCheckSettingShowProfile()); mapSqlParameterSource.addValue("checkSettingShowWeather", settingFrontEnd.getCheckSettingShowWeather()); mapSqlParameterSource.addValue("id", user.getId()); jdbcOperations.update(SQL_QUERY_UPDATE_SETTING, mapSqlParameterSource); if (LOG.isInfoEnabled()) { LOG.info("set setting front end of user. User : " + user + ". SettingFrontEnd " + settingFrontEnd); }//from www.j a va 2s .com }
From source file:com.joliciel.jochre.security.SecurityDaoJdbc.java
@Override public User findUser(String username) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_USER + " FROM ocr_user WHERE user_username=:user_username"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("user_username", username); LOG.info(sql);/*w w w .j a v a 2 s . co m*/ logParameters(paramSource); User user = null; try { user = (User) jt.queryForObject(sql, paramSource, new UserMapper(this.getSecurityServiceInternal())); } catch (EmptyResultDataAccessException ex) { ex.hashCode(); } return user; }
From source file:org.inbio.modeling.core.dao.impl.SystemUserDAOImpl.java
@Override public void deleteUserByUsername(String userName) { String sqlStatement = null;//from w w w . ja va 2 s .co m MapSqlParameterSource args = null; try { sqlStatement = "DELETE FROM " + this.table + " WHERE username = :username "; args = new MapSqlParameterSource(); args.addValue("username", userName); getSimpleJdbcTemplate().update(sqlStatement, args); } catch (Exception e) { e.printStackTrace(); } }