package com.ssj.dao.sys.poster.dao;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.ssj.bean.sys.poster.domain.PosterTemplate;

/**
 * @author Mount Liu
 * @date 2019/3/17
 */
@Repository
public interface PosterTemplateDao extends JpaRepository<PosterTemplate, String> {

	@Query(nativeQuery = true,value = " SELECT * from poster_template t WHERE t.`status`=1 ORDER BY t.create_time desc ")
	List<PosterTemplate> findPosterTemplateByList();

	@Query(nativeQuery = true,value = " SELECT * from poster_template t WHERE t.`status`=1 and t.id in(?1) ORDER BY t.create_time desc ")
	List<PosterTemplate> findPosterTemplateByIds(List<String> templateIds);

    Page<PosterTemplate> findAll(Specification<PosterTemplate> specification, Pageable sp);
}
