private Map<Long, String> initShops(List<Long> ids) throws IOException { Map<Long, String> sites = new LinkedHashMap<Long, String>(); JdbcShopDao dao = new JdbcShopDao(); List<Shop> shops = dao.findByPrimaryKeys(ids); for (Shop shop : shops) { sites.put(shop.getId(), shop.getUrl()); } return sites; }
@Test public void test_update_all_fromDb() throws IOException { JdbcShopDao dao = new JdbcShopDao(); String category = "3C数码配件"; // "家纺/床上用品/布艺"; // "3C数码配件" // "五金/工具" // "服装/内衣/配件" // 3C last date 5/1 boolean isActive = true; List<Long> ids = dao.queryShopIdsByCategory(category, isActive); Map<Long, String> urls = initShops(ids); scan(urls); }