package com.ssj.service.weixin.zuoyb.service.impl;

import com.ssj.bean.weixin.zyb.domain.ZuoybKnowHowDetailsKd;
import com.ssj.dao.weixin.zuoyb.dao.ZuoybKnowHowDetailsKdDao;
import com.ssj.dao.weixin.zuoyb.dao.ZuoybQueryDao;
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.weixin.zuoyb.service.ZuoybKnowHowDetailsKdService;
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.List;
import java.util.Map;


/** 
 * @author  ZhangCaibao 
 * @version 2018年5月1日 上午11:06:39 
 * 类说明 
 */
@Service
@Transactional
public class ZuoybKnowHowDetailsKdServiceImpl extends BaseServiceImpl<ZuoybKnowHowDetailsKd, String> implements ZuoybKnowHowDetailsKdService{
	@Autowired
	private  ZuoybKnowHowDetailsKdDao  zuoybKnowHowDetailsKdDao;
	@Autowired
	private ZuoybQueryDao queryDao;
	@Override
	public PagingAndSortingRepository<ZuoybKnowHowDetailsKd, String> getDao() {
		return zuoybKnowHowDetailsKdDao;
	}
	@Override
	public List<ZuoybKnowHowDetailsKd> findByHowDetailsId(String howDetailsId) {
		return zuoybKnowHowDetailsKdDao.findByHowDetailsId(howDetailsId);
	}
	@Override
	public Page<ZuoybKnowHowDetailsKd> findByPage(Map<String, Object> params,
			Pageable sp) {
		Map<String, SearchFilter> filters = SearchFilter.parse(params);
		Specification<ZuoybKnowHowDetailsKd> specification = DynamicSpecifications.bySearchFilter(filters.values(), ZuoybKnowHowDetailsKd.class);    
		return  zuoybKnowHowDetailsKdDao.findAll(specification, sp);
	}
	@Override
	public void updateKnowHowDetailKdNum(String id, Integer num) {
		zuoybKnowHowDetailsKdDao.updateKnowHowDetailKdNum(id, num);
	}
	@Override
	public Page<Map<String, Object>> getZuoybKnowHowDetailsKd(
			Map<String, Object> searchParams, Pageable pageable) {
		return queryDao.getZuoybKnowHowDetailsKd(searchParams, pageable);
	}
	@Override
	public List<ZuoybKnowHowDetailsKd> getHowDetailsKdIds(String libId, String courseName,
			String grade, String semester, String type,String detailsId) {
		return zuoybKnowHowDetailsKdDao.getHowDetailsKdIds(libId, courseName, grade, semester, type, detailsId);
	}

}
