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

import com.ssj.bean.kmt.kmt.domain.KmtExampaperArea;
import com.ssj.dao.kmt.kmt.dao.IKmtExampaperAreaDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.framework.core.persistence.DynamicSpecifications;
import com.ssj.framework.core.persistence.SearchFilter;
import com.ssj.service.kmt.service.IKmtExampaperAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

@Transactional
@Service
public class KmtExampaperAreaServiceImpl extends BaseServiceImpl<KmtExampaperArea, String>
		implements IKmtExampaperAreaService {

	@Autowired
	private IKmtExampaperAreaDao dao;
	
	@Override
	public PagingAndSortingRepository<KmtExampaperArea, String> getDao() {
		
		return dao;
	}
	@Override
	public Page<KmtExampaperArea> findByPage(Map<String, Object> params, Pageable sp) {
		 Map<String, SearchFilter> filters = SearchFilter.parse(params);
			Specification<KmtExampaperArea> specification = DynamicSpecifications.bySearchFilter(filters.values(), KmtExampaperArea.class);
			return  dao.findAll(specification, sp);
	}
	@Override
	public KmtExampaperArea findBeanByAnyThings(String year, String city, String area, String school, Integer semester,
			Integer type, String subject, String grade,String addStr) {
		
		return dao.findBeanByAnyThings( year,  city,  area,  school, semester,type,  subject,  grade,addStr);
	}
	@Override
	public KmtExampaperArea findBeanByAnyThings(String year, String city, String area, String school, Integer semester,
			Integer type, String subject, String grade,String addStr, String id) {
		return dao.findBeanByAnyThings( year,  city,  area,  school, semester,type,  subject,  grade,addStr,id);
	}

}
