/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository.consult;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.yihu.wlyy.entity.consult.ConsultCommunicationReply;

public interface ConsultCommunicationReplyDao extends PagingAndSortingRepository<ConsultCommunicationReply, Long>, JpaSpecificationExecutor<ConsultCommunicationReply> {
	
	@Query("select a from ConsultCommunicationReply a where a.consult = ?1 and a.del = '1'")
	Page<ConsultCommunicationReply> findReplyListByConsult(String consult, Pageable pageRequest);
	
	@Query("select a from ConsultCommunicationReply a where a.consult = ?1 and a.id < ?2 and a.del = '1'")
	Page<ConsultCommunicationReply> findReplyListByConsult(String consult, long id, Pageable pageRequest);
}
