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

import com.ssj.bean.kmt.kmt.domain.KmtCourseTemplate;
import com.ssj.dao.kmt.kmt.dao.KmtCourseTemplateDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.kmt.service.KmtCourseTemplateService;
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 KmtCourseTemplateServiceImpl extends BaseServiceImpl<KmtCourseTemplate, String> implements KmtCourseTemplateService {

	@Autowired
	private KmtCourseTemplateDao dao;

	@Override
	public PagingAndSortingRepository<KmtCourseTemplate, String> getDao() {
		return dao;
	}

	@Override
	public List<KmtCourseTemplate> findTemplateByList(String teacherId,String type) {
		return dao.findTemplateByList(teacherId,type);
	}

	@Override
	public List<String> findHasTimeTeacherByCourseTime(String[] teacherIds, int week, String courseTime) {
		return dao.findTeacherCourseTime(week, courseTime, teacherIds);
	}

	@Override
	public List<String> findHasTimeTeacherByWeek(String[] teacherIds, int[] weeks, String courseTime) {
		return dao.findTeacherByWeek(weeks, courseTime, teacherIds);
	}

	public KmtCourseTemplate findTemplateByTeacherId  (String teacherId, String courseTime) {
		return dao.findByTeacherIdAndState(teacherId, courseTime, 1);
	}


	public List<KmtCourseTemplate> findByTeacherIdAndWeek (String teacherId, int week){
		return dao.findByTeacherAndWeek(teacherId, week);
	}

	@Override
	public KmtCourseTemplate findTemplateByAnyThing(String teacherId, int type, String val) {
		
		return dao.findTemplateByAnyThing(teacherId,type,val);
	}

	@Override
	public void setTeacherDataState(String teacherId, int type) {
		dao.setTeacherDataState(teacherId,type);
	}
}
