@Test public void testAddHotSearch() throws Exception { boolean b = service.addHotSearch("请问"); Assert.assertTrue(b); }
@Override public boolean addHotSearch(String keywords) { if (null == keywords) return false; HotSearch hs = new HotSearch(); hs.setName(keywords); HotSearch hotSearch = mapper.selectOne(hs); if (null != hotSearch) { return mapper.updateRecommend(hotSearch.getId(),hotSearch.getFrequency()+1) > 0; } else { hs.setFrequency(1L); return mapper.insert(hs) > 0; } }
HotSearchServiceImpl implements IHotSearchService { @Override public boolean addHotSearch(String keywords) { if (null == keywords) return false; HotSearch hs = new HotSearch(); hs.setName(keywords); HotSearch hotSearch = mapper.selectOne(hs); if (null != hotSearch) { return mapper.updateRecommend(hotSearch.getId(),hotSearch.getFrequency()+1) > 0; } else { hs.setFrequency(1L); return mapper.insert(hs) > 0; } } }
HotSearchServiceImpl implements IHotSearchService { @Override public boolean addHotSearch(String keywords) { if (null == keywords) return false; HotSearch hs = new HotSearch(); hs.setName(keywords); HotSearch hotSearch = mapper.selectOne(hs); if (null != hotSearch) { return mapper.updateRecommend(hotSearch.getId(),hotSearch.getFrequency()+1) > 0; } else { hs.setFrequency(1L); return mapper.insert(hs) > 0; } }  }
HotSearchServiceImpl implements IHotSearchService { @Override public boolean addHotSearch(String keywords) { if (null == keywords) return false; HotSearch hs = new HotSearch(); hs.setName(keywords); HotSearch hotSearch = mapper.selectOne(hs); if (null != hotSearch) { return mapper.updateRecommend(hotSearch.getId(),hotSearch.getFrequency()+1) > 0; } else { hs.setFrequency(1L); return mapper.insert(hs) > 0; } }  @Override boolean addHotSearch(String keywords); @Override List<String> queryRecommend(); }
HotSearchServiceImpl implements IHotSearchService { @Override public boolean addHotSearch(String keywords) { if (null == keywords) return false; HotSearch hs = new HotSearch(); hs.setName(keywords); HotSearch hotSearch = mapper.selectOne(hs); if (null != hotSearch) { return mapper.updateRecommend(hotSearch.getId(),hotSearch.getFrequency()+1) > 0; } else { hs.setFrequency(1L); return mapper.insert(hs) > 0; } }  @Override boolean addHotSearch(String keywords); @Override List<String> queryRecommend();  }