当前位置: 首页>>代码示例>>Java>>正文


Java SimpleJdbcTemplate.query方法代码示例

本文整理汇总了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;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:28,代码来源:RedmineDAOImpl.java

示例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();
    }
}
 
开发者ID:intuit,项目名称:Tank,代码行数:13,代码来源:JdbcMessageDAO.java

示例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;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:34,代码来源:RedmineDAOImpl.java

示例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;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:32,代码来源:RedmineDAOImpl.java


注:本文中的org.springframework.jdbc.core.simple.SimpleJdbcTemplate.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。