Search in sources :

Example 1 with RegContentFtp

use of com.rainsoft.domain.RegContentFtp in project beijingThirdPeriod by weidongcao.

the class FtpDaoImpl method getFtpBydate.

@Override
public List<RegContentFtp> getFtpBydate(String date) {
    JdbcTemplate jdbcTemplate = getJdbcTemplate();
    jdbcTemplate.setFetchSize(1000);
    String templeSql = "select * from REG_CONTENT_FTP where import_time >= to_date('${date}' ,'yyyy-mm-dd') and import_time < (to_date('${date}' ,'yyyy-mm-dd') + 1)";
    String sql = templeSql.replace("${date}", date);
    logger.info("FTP数据获取一天数据的sql: {}", sql);
    return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(RegContentFtp.class));
}
Also used : RegContentFtp(com.rainsoft.domain.RegContentFtp) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate)

Example 2 with RegContentFtp

use of com.rainsoft.domain.RegContentFtp in project beijingThirdPeriod by weidongcao.

the class TestSpringOracle method testSpringConnectionOracle.

private static void testSpringConnectionOracle() {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext("spring-module.xml");
    FtpDao ftpDao = (FtpDao) context.getBean("ftpDao");
    // 获取数据库一天的数据
    RegContentFtp ftp = ftpDao.getFtpById(1905067);
    JSONObject jsonObject = JSONObject.fromObject(ftp);
    System.out.println(jsonObject.toString());
    context.close();
}
Also used : AbstractApplicationContext(org.springframework.context.support.AbstractApplicationContext) JSONObject(net.sf.json.JSONObject) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) RegContentFtp(com.rainsoft.domain.RegContentFtp) FtpDao(com.rainsoft.dao.FtpDao)

Example 3 with RegContentFtp

use of com.rainsoft.domain.RegContentFtp in project beijingThirdPeriod by weidongcao.

the class FtpDaoImpl method getFtpById.

@Override
public RegContentFtp getFtpById(int id) {
    JdbcTemplate jdbcTemplate = getJdbcTemplate();
    jdbcTemplate.setFetchSize(1000);
    String sql = "select * from REG_CONTENT_FTP where id = ?";
    List<RegContentFtp> list = jdbcTemplate.query(sql, new Object[] { id }, new BeanPropertyRowMapper<>(RegContentFtp.class));
    return list.get(0);
}
Also used : RegContentFtp(com.rainsoft.domain.RegContentFtp) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate)

Aggregations

RegContentFtp (com.rainsoft.domain.RegContentFtp)3 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)2 FtpDao (com.rainsoft.dao.FtpDao)1 JSONObject (net.sf.json.JSONObject)1 AbstractApplicationContext (org.springframework.context.support.AbstractApplicationContext)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1