package com.yihu.wlyy.repository.doctor;

import com.yihu.wlyy.entity.doctor.survey.Survey;
import com.yihu.wlyy.entity.patient.SignWeb;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
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 javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by Reece on 2017/3/9.
 */

public interface SurveyDao extends PagingAndSortingRepository<Survey, Long> {

    @Query("select t from Survey t")
    Page<Survey> findAll(Pageable request);

    @Query("select t from Survey t where t.code = ?1")
    Survey findById(String code);

    @Modifying
    @Query("update Survey t set t.status = ?1 where t.code = ?2 ")
    void modifyStatus(int status ,String code);
}
