package com.qmth.qrzk.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.qmth.qrzk.dao.IQuestionDao;
import com.qmth.qrzk.repository.common.mapper.QuestionMapper;
import com.qmth.qrzk.repository.user.model.Question;

@Repository("questionDaoImpl")
@Transactional
public class QuestionDaoImpl implements IQuestionDao {

	@Autowired
	@Qualifier("questionMapper")
	private QuestionMapper questionMapper;
	
	@Override
	public int addQuestion(Question question) {
		// TODO Auto-generated method stub
		return questionMapper.saveQuestion(question);
	}

	@Override
	public List<Question> selectQuestion(Question question,int showCount,int currentPage) {
		// TODO Auto-generated method stub
		return questionMapper.searchByCondition( question, showCount, currentPage);
	}

	@Override
	public int getCount(Question question) {
		// TODO Auto-generated method stub
		return questionMapper.searchByConditionCount(question);
	}

	@Override
	public int importQuestion(Question question) {
		return questionMapper.importQuestion(question);
	}

	@Override
	public Question searchById(int id) {
		// TODO Auto-generated method stub
		return questionMapper.searchById(id);
	}

	@Override
	public void updateQuestion(Question question) {
		questionMapper.updateQuestion(question);
	}

	@Override
	public List<Question> generatePaperQuestion(Question question) {
		return questionMapper.generatePaperQuestion(question);
	}

	@Override
	public int updateStatus(Question question) {
		// TODO Auto-generated method stub
		return questionMapper.updateAudit(question);
	}

	@Override
	public int searchAuditCount(Question question, String condition1,
			String condition2) {
		// TODO Auto-generated method stub
		return questionMapper.searchAuditCount(question, condition1, condition2);
	}

	@Override
	public List<Question> searchAudit(Question question, int showCount,
			int currentPage, String condition1, String condition2) {
		// TODO Auto-generated method stub
		return questionMapper.searchAudit(question, showCount, currentPage, condition1, condition2);
	}

	@Override
	public List<Question> findAll() {
		// TODO Auto-generated method stub
		return questionMapper.findAll();
	}

	@Override
	public List<Question> getStatusCount() {
		// TODO Auto-generated method stub
		return questionMapper.getStatusCount();
	}

	@Override
	public int getMaxChapterByCourseId(int courseId) {
		// TODO Auto-generated method stub
		return questionMapper.getMaxChapterByCourseId(courseId);
	}

	@Override
	public int getCountByCondition(Question question) {
		// TODO Auto-generated method stub
		return questionMapper.getCountByCondition(question);
	}

	@Override
	public int getCountByChapter(Question question) {
		// TODO Auto-generated method stub
		return questionMapper.getCountByChapter(question);
	}
	
	public List<Question> findRecent3YearQues(Question question) {
		return questionMapper.findRecent3YearQues(question);
	}
	
	public List<Question> queryQuestionKeyTJ(Question question) {
		return questionMapper.queryQuestionKeyTJ(question);
	}
}
