⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wordcardservice.java

📁 使用spring+ibatis框架编写的单词卡片记忆系统。
💻 JAVA
字号:
package cn.avl.wordcard.service;

import com.littleQworks.commons.dao.ibatis.spring.CommonDaoGenericImpl;
import java.util.*;

import cn.avl.wordcard.domain.*;

public class WordcardService {
	private CommonDaoGenericImpl commonDao;
	
	public CommonDaoGenericImpl getCommonDao() {
		return commonDao;
	}
	public void setCommonDao(CommonDaoGenericImpl commonDao) {
		this.commonDao = commonDao;
	}
	
	public boolean insertWord(Word word){
		return commonDao.insertByParameter(word, "insertWord");
	}
	
	public boolean insertExplanation(Explanation explanation){
		return commonDao.insertByParameter(explanation, "insertExplanation");
	}
	
	public List<String> getAllWords(){
		return commonDao.getList("getAllWords");
	}
	
	public List<String> getCategoryByWord(String word){
		return commonDao.getListByParameter(word, "getCategoryByWord");
	}
	
	public Word getWordByWord(String word){
		return commonDao.getByParamter(word, "getWordByWord");
	}
	
	public List<String> getWordByFirst(String first){
		return commonDao.getListByParameter(first, "getWordByFirst");
	}
	
	public List<Explanation> getExplanationByWordAndCategory(String word,String category){
		HashMap<String,String> hashmap = new HashMap<String,String>();
		hashmap.put("word", word);
		hashmap.put("category", category);
		return commonDao.getListByParameter(hashmap, "getExplanationByWordAndCategory");
	}
	
	public List<String> getAssociationWord(String word){
		List<String> l1 = commonDao.getListByParameter(word, "getAssociationWord1");
		List<String> l2 = commonDao.getListByParameter(word, "getAssociationWord2");
		l1.addAll(l2);
		return l1;
	}
	
	public boolean deleteWord(String word){
		return commonDao.deleteByParameter(word, "deleteWord");
	}
	
	public boolean deleteAss(String word1,String word2){
		HashMap<String,String> hashmap = new HashMap<String,String>();
		hashmap.put("word1", word1);
		hashmap.put("word2", word2);		
		return commonDao.deleteByParameter(hashmap, "deleteAss");
	}	
	
	public boolean addAssWord(String word1,String word2){
		HashMap<String,String> hashmap = new HashMap<String,String>();
		hashmap.put("word1", word1);
		hashmap.put("word2", word2);
		return commonDao.insertByParameter(hashmap, "addAssWord");
	}
	
	public boolean insertSentence(Sentence sentence){
		return commonDao.insertByParameter(sentence, "insertSentence");
	}
	
	public List<Sentence> getSentence(String expID){
		return commonDao.getListByParameter(expID, "getSentence");
	}
	
	public boolean deleteSentence(String expID,String sentence){
		HashMap<String,String> hashmap = new HashMap<String,String>();
		hashmap.put("expID",expID);
		hashmap.put("sentence", sentence);		
		return commonDao.deleteByParameter(hashmap, "deleteSentence");
	}
	
	public int getCountOfExp(String word){
		return commonDao.getByParamter(word,"getCountOfExp");
	}
	
	
	public boolean deleteExplanation(String expID){
		return commonDao.deleteByParameter(expID, "deleteExplanation");
	}
	
	public int getCountOfWords(){
		return commonDao.get("getCountOfWords");
	}
	
	public String getWordByIndex(int index){
		return commonDao.getByParamter(index, "getWordByIndex");
	}
	public static void main(String[] args){
		WordcardService service = ServiceFactory.getWordcardService();
		System.out.println(service.deleteWord("yield"));
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -