@Test public void testWC5_SelectWordCountByWord_查询词频统计结果0查询频次开前的N个结果() { assertEquals("[{\"word\":\"词语2\",\"count\":15},{\"word\":\"词语1\",\"count\":13}]", JsonUtils.toJsonWithoutPretty(wordCount.selectWordCountTopN(2))); }
public List<WordAndCount> selectWordCountTopN(int N) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); return wordCountDao.selectWordCountTopN(N); } }
WordCount { public List<WordAndCount> selectWordCountTopN(int N) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); return wordCountDao.selectWordCountTopN(N); } } }
WordCount { public List<WordAndCount> selectWordCountTopN(int N) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); return wordCountDao.selectWordCountTopN(N); } } WordCount(MybatisConfig.ServerEnum server); }
WordCount { public List<WordAndCount> selectWordCountTopN(int N) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); return wordCountDao.selectWordCountTopN(N); } } WordCount(MybatisConfig.ServerEnum server); void addWordCountByOne(String word); void deleteWordCount(String word); void insertWordCount(String tablename, String word, int count); boolean isWordCountExisted(String word); int selectWordCountByWord(String word); List<WordAndCount> selectWordCountTopN(int N); void updateWordCount(String word, int count); }
WordCount { public List<WordAndCount> selectWordCountTopN(int N) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); return wordCountDao.selectWordCountTopN(N); } } WordCount(MybatisConfig.ServerEnum server); void addWordCountByOne(String word); void deleteWordCount(String word); void insertWordCount(String tablename, String word, int count); boolean isWordCountExisted(String word); int selectWordCountByWord(String word); List<WordAndCount> selectWordCountTopN(int N); void updateWordCount(String word, int count);  }