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

import com.ym.mec.biz.dal.dao.CourseHomeworkTemplateDao;
import com.ym.mec.biz.dal.entity.CourseHomeworkTemplate;
import com.ym.mec.biz.dal.page.CourseHomeWorkTemplateQueryInfo;
import com.ym.mec.biz.service.CourseHomeworkTemplateService;
import com.ym.mec.common.page.PageInfo;
import com.ym.mec.common.page.QueryInfo;

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

import com.ym.mec.common.dal.BaseDAO;
import com.ym.mec.common.service.impl.BaseServiceImpl;

@Service
public class CourseHomeworkTemplateServiceImpl extends BaseServiceImpl<Integer, CourseHomeworkTemplate>  implements CourseHomeworkTemplateService {
	
	@Autowired
	private CourseHomeworkTemplateDao courseHomeworkTemplateDao;

	@Override
	public BaseDAO<Integer, CourseHomeworkTemplate> getDAO() {
		return courseHomeworkTemplateDao;
	}

	@Override
	public PageInfo<CourseHomeworkTemplate> queryPage(QueryInfo queryInfo) {
		CourseHomeWorkTemplateQueryInfo templateQueryInfo= (CourseHomeWorkTemplateQueryInfo) queryInfo;
		if(null!=templateQueryInfo.getCourseScheduleID()){
			templateQueryInfo.setSubjectIDs(courseHomeworkTemplateDao.getSubjectIDs(templateQueryInfo.getCourseScheduleID()).split(","));
		}
		return super.queryPage(templateQueryInfo);
	}
}