package com.ym.mec.biz.service.impl;

import com.ym.mec.biz.dal.dao.TeacherSchoolDao;
import com.ym.mec.biz.dal.entity.TeacherSchool;
import com.ym.mec.biz.service.TeacherSchoolService;
import com.ym.mec.common.dal.BaseDAO;
import com.ym.mec.common.exception.BizException;
import com.ym.mec.common.service.impl.BaseServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

@Service
public class TeacherSchoolServiceImpl extends BaseServiceImpl<Long, TeacherSchool> implements TeacherSchoolService {
	
	@Autowired
	private TeacherSchoolDao teacherSchoolDao;

	@Override
	public BaseDAO<Long, TeacherSchool> getDAO() {
		return teacherSchoolDao;
	}

	@Override
	public List<TeacherSchool> findByTeacherId(Integer teacherId) {
		if(Objects.isNull(teacherId)){
			throw new BizException("请指定教师");
		}
		return teacherSchoolDao.findByTeacherId(teacherId);
	}


}