@Test(expected = Exception.class) public void testWC0_InsertWordCount_插入词频统计结果_抛出异常() { wordCount.insertWordCount("wordcount1", "词语1", 10); }
public void insertWordCount(String tablename, String word, int count) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); wordCountDao.insertWordCount(new InsertWordCount(tablename, word, count)); sqlSession.commit(); } }
WordCount { public void insertWordCount(String tablename, String word, int count) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); wordCountDao.insertWordCount(new InsertWordCount(tablename, word, count)); sqlSession.commit(); } } }
WordCount { public void insertWordCount(String tablename, String word, int count) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); wordCountDao.insertWordCount(new InsertWordCount(tablename, word, count)); sqlSession.commit(); } } WordCount(MybatisConfig.ServerEnum server); }
WordCount { public void insertWordCount(String tablename, String word, int count) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); wordCountDao.insertWordCount(new InsertWordCount(tablename, word, count)); sqlSession.commit(); } } 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 void insertWordCount(String tablename, String word, int count) { try (SqlSession sqlSession = sqlSessionFactory.openSession();) { WordCountDao wordCountDao = sqlSession.getMapper(WordCountDao.class); wordCountDao.insertWordCount(new InsertWordCount(tablename, word, count)); sqlSession.commit(); } } 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);  }