package com.yihu.wlyy.repository.education;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.yihu.wlyy.entity.education.HealthEduArticlePatient;

import java.util.List;

public interface HealthEduArticlePatientDao extends PagingAndSortingRepository<HealthEduArticlePatient, Long>, JpaSpecificationExecutor<HealthEduArticlePatient> {

	// 更新为已读
	@Modifying
	@Query("update HealthEduArticlePatient a set a.read = 0 where a.patient = ?1 and a.article = ?2 ")
	int updateRead(String patient, String article);
	HealthEduArticlePatient findByArticle(String article);

	List<HealthEduArticlePatient> findByArticleAndPatient(String article,String patient);

}
