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

import com.ssj.bean.weixin.story.bean.StoryCardReply;
import com.ssj.dao.weixin.story.dao.StoryCardReplyDao;
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.story.service.StoryCardReplyService;
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;


/** 
 * @author  ZhangCaibao 
 * @version 2017年6月13日 下午2:32:35 
 * 类说明 
 */
@Service
@Transactional
public class StoryCardReplyServiceImpl  extends BaseServiceImpl<StoryCardReply, String> implements StoryCardReplyService{
	@Autowired
	private  StoryCardReplyDao  storyCardReplyDao;
	@Override
	public Page<StoryCardReply> findByPage(Map<String, Object> params,
			Pageable sp) {
		Map<String, SearchFilter> filters = SearchFilter.parse(params);
		Specification<StoryCardReply> specification = DynamicSpecifications.bySearchFilter(filters.values(), StoryCardReply.class);    
		return  storyCardReplyDao.findAll(specification, sp);
	}

	@Override
	public PagingAndSortingRepository<StoryCardReply, String> getDao() {
		return storyCardReplyDao;
	}

}
