package com.ssj.service.kmt.kmt.service.impl;

import com.ssj.bean.kmt.kmt.domain.KmtQuestionTemp;
import com.ssj.dao.kmt.kmt.dao.KmtQueryDao;
import com.ssj.dao.kmt.kmt.dao.KmtQuestionTempDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.kmt.service.KmtQuestionTempService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Transactional
@Service
public class KmtQuestionTempServiceImpl   extends BaseServiceImpl<KmtQuestionTemp, String> implements KmtQuestionTempService {

private   Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private KmtQuestionTempDao dao;
	
	@Autowired
	private KmtQueryDao queryDao;
	
	
	@Override
	public PagingAndSortingRepository<KmtQuestionTemp, String> getDao() {
		return dao;
	}


	@Override
	public List<KmtQuestionTemp> findQuList(Integer page, Integer pageSize, String courseName,String userName,Integer state) {
		if(StringUtils.isNotEmpty(userName)){
			return dao.findQuList(page, pageSize, courseName, userName,state);
		}else{
			return dao.findQuList(page, pageSize, courseName,state);
		}
		
	}
	
	


	@Override
	public Integer queryQuTmpCount() {
		return queryDao.queryQuTmpCount();
	}


	@Override
	public List<KmtQuestionTemp> findQuList(String courseName) {
		return dao.findQuList( courseName);
	}


	@Override
	public void updateTempUser(String courseName, String username, Integer num) {
		dao.updateTempUser(courseName, username, num);
	}


	@Override
	public List<KmtQuestionTemp> findQuByStateList(Integer state) {
		return dao.findQuByStateList(state);
	}
	
	


}
