本文整理汇总了Java中org.springframework.jdbc.core.simple.SimpleJdbcTemplate.query方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleJdbcTemplate.query方法的具体用法?Java SimpleJdbcTemplate.query怎么用?Java SimpleJdbcTemplate.query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jdbc.core.simple.SimpleJdbcTemplate
的用法示例。
在下文中一共展示了SimpleJdbcTemplate.query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pesquisarIssues
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; //导入方法依赖的package包/类
/**
* Consulta issues pelo id. Traz detalhes do repositorio e nome do projeto
*
* @return
*/
public List<IssueVO> pesquisarIssues(Long... issueId) {
final String queryIssue =
" select " +
" i.id, " +
" st.is_closed, " +
" r.url, " +
" r.root_url, " +
" r.project_id, " +
" p.name," +
" p.parent_id " +
" from issues i " +
" inner join repositories r on r.project_id = i.project_id " +
" inner join issue_statuses st on st.id = i.status_id " +
" inner join projects p on p.id = r.project_id" +
" where i.id in (:ids) ";
SimpleJdbcTemplate simpleJdbcTemplate = getSimpleJdbcTemplate();
List<IssueVO> issue = simpleJdbcTemplate.query(queryIssue, new IssueVORowMapper(), Collections.singletonMap("ids", Arrays.asList(issueId)));
return issue;
}
示例2: listConversationsSince
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; //导入方法依赖的package包/类
public Collection<Integer> listConversationsSince(int id)
throws DataAccessException {
MapSqlParameterSource params = new MapSqlParameterSource();
try {
params.addValue(ID, id, Types.INTEGER);
SimpleJdbcTemplate template = new SimpleJdbcTemplate(
getNamedParameterJdbcTemplate());
return template.query(SELECT_CONVERSATIONS, ID_MAPPER, params);
} catch (EmptyResultDataAccessException erdae) {
return Collections.emptyList();
}
}
示例3: affectedRepoUUID
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; //导入方法依赖的package包/类
/**
* Detecta repositorios registrados no redmine e seus respectivos projetos que foram afetados pela mudança, a partir da URL alterada
* @param urlAlteracao
* @param repoUUID
* @return
*/
protected List<RepositorioVO> affectedRepoUUID(String urlAlteracao, String repoUUID) {
final String queryRepositoriosAfetados = " select " +
" p.id, " +
" p.name, " +
" p.parent_id, " +
" r.id repository_id, " +
" r.url, " +
" r.repouuid, " +
" r.root_url " +
" from " +
" repositories r "+
" inner join projects p on " +
" p.id = r.id " +
" where " +
" r.repouuid = ? and " +
" instr(concat(r.root_url,'/',?),r.url) " +
" order by " +
" length(url) desc";
SimpleJdbcTemplate jdbcTemplate = getSimpleJdbcTemplate();
List<RepositorioVO> repositorioVOs = jdbcTemplate.query(queryRepositoriosAfetados, new RepositorioRowMapper(), repoUUID, urlAlteracao);
determinaProjetosAfetados(repositorioVOs);
return repositorioVOs;
}
示例4: affectedRepoNoUUID
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; //导入方法依赖的package包/类
/**
* Consulta projetos afetados pela mudança realizada na url informada.
*
* @return
*/
protected List<RepositorioVO> affectedRepoNoUUID(String urlAlteracao) {
final String queryRepositoriosAfetados = " select " +
" p.id, " +
" p.name, " +
" p.parent_id, " +
" r.id repository_id, " +
" r.url, " +
" r.root_url " +
" from " +
" repositories r "+
" inner join projects p on " +
" p.id = r.id " +
" where " +
" instr(concat(r.root_url,'/',?),r.url) " +
" order by " +
" length(url) desc";
SimpleJdbcTemplate jdbcTemplate = getSimpleJdbcTemplate();
List<RepositorioVO> repositorioVOs = jdbcTemplate.query(queryRepositoriosAfetados, new RepositorioRowMapper(false), urlAlteracao);
determinaProjetosAfetados(repositorioVOs);
return repositorioVOs;
}