@Test public void testgetBySrc() { Assert.assertTrue(backUpInfoDao.getByDest("1").size() == 0); BackUpInfo[] backUpInfos = new BackUpInfo[2]; backUpInfos[0] = new BackUpInfo(1, "test", "test", 1); backUpInfos[1] = new BackUpInfo(2, "test", "test", 1); backUpInfoDao.insert(backUpInfos); List<BackUpInfo> list = backUpInfoDao.getBySrc("test"); Assert.assertTrue(list.size() == 2); Assert.assertTrue(list.get(0).equals(backUpInfos[0])); Assert.assertTrue(list.get(1).equals(backUpInfos[1])); Assert.assertTrue(backUpInfoDao.getCountByRid(1) == 0); }
public List<BackUpInfo> getBySrc(String src) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM backup_file WHERE src = ?", new Object[] {src}, new BackUpInfoRowMapper()); }
BackUpInfoDao { public List<BackUpInfo> getBySrc(String src) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM backup_file WHERE src = ?", new Object[] {src}, new BackUpInfoRowMapper()); } }
BackUpInfoDao { public List<BackUpInfo> getBySrc(String src) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM backup_file WHERE src = ?", new Object[] {src}, new BackUpInfoRowMapper()); } BackUpInfoDao(DataSource dataSource); }
BackUpInfoDao { public List<BackUpInfo> getBySrc(String src) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM backup_file WHERE src = ?", new Object[] {src}, new BackUpInfoRowMapper()); } BackUpInfoDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<BackUpInfo> getAll(); List<BackUpInfo> getByIds(List<Long> rids); int getCountByRid(int rid); BackUpInfo getByRid(long rid); List<BackUpInfo> getBySrc(String src); List<BackUpInfo> getByDest(String dest); void delete(long rid); void insert(BackUpInfo backUpInfo); void insert(BackUpInfo[] backUpInfos); int update(long rid, long period); void deleteAll(); }
BackUpInfoDao { public List<BackUpInfo> getBySrc(String src) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM backup_file WHERE src = ?", new Object[] {src}, new BackUpInfoRowMapper()); } BackUpInfoDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<BackUpInfo> getAll(); List<BackUpInfo> getByIds(List<Long> rids); int getCountByRid(int rid); BackUpInfo getByRid(long rid); List<BackUpInfo> getBySrc(String src); List<BackUpInfo> getByDest(String dest); void delete(long rid); void insert(BackUpInfo backUpInfo); void insert(BackUpInfo[] backUpInfos); int update(long rid, long period); void deleteAll();  }