package com.ssj.service.sys.poster.service.impl;

import java.util.List;
import java.util.Map;

import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
import com.ssj.framework.core.persistence.DynamicSpecifications;
import com.ssj.framework.core.persistence.SearchFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 com.ssj.bean.sys.poster.domain.PosterTemplate;
import com.ssj.dao.sys.poster.dao.PosterQueryDao;
import com.ssj.dao.sys.poster.dao.PosterTemplateDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.sys.poster.service.PosterTemplateService;

@Service
@Transactional
public class PosterTemplateServiceImpl extends BaseServiceImpl<PosterTemplate, String> implements PosterTemplateService {

	private  Logger logger = LoggerFactory.getLogger(this.getClass());
	
    @Autowired
    private PosterTemplateDao dao;

    @Autowired
    private PosterQueryDao posterQueryDao;
    
    @Override
	public PagingAndSortingRepository<PosterTemplate, String> getDao() {
		return dao;
	}

	@Override
	public List<PosterTemplate> findPosterTemplateByList() {
		return dao.findPosterTemplateByList();
	}

	@Override
	public List<PosterTemplate> findPosterTemplateByIds(List<String> templateIds) {
		return dao.findPosterTemplateByIds(templateIds);
	}

	@Override
	public Page<PosterTemplate> findBypage(Map<String, Object> params, Pageable sp) {
		Map<String, SearchFilter> filters = SearchFilter.parse(params);
		Specification<PosterTemplate> specification = DynamicSpecifications.bySearchFilter(filters.values(), PosterTemplate.class);
		return  dao.findAll(specification, sp);
	}


}
