package com.yihu.wlyy.repository.doctor;

import com.yihu.wlyy.entity.doctor.survey.SurveyQuestionnaireOptions;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import javax.persistence.Entity;
import java.util.List;

/**
 * Created by Reece on 2017/3/10.
 */
public interface SurveyQuestionnaireOptionsDao extends PagingAndSortingRepository<SurveyQuestionnaireOptions, Long> {
    @Query("select t  from SurveyQuestionnaireOptions t where  t.questionnaireCode = ?1")
    List<SurveyQuestionnaireOptions> findById(String qstcode);

    @Query("select t  from SurveyQuestionnaireOptions t where  t.surveyCode =?1 and t.questionnaireCode = ?2")
    List<SurveyQuestionnaireOptions> findByIdAndQstCode(String surveycode,String qstcode);

    @Query("select t  from SurveyQuestionnaireOptions t where  t.surveyCode = ?1 and t.questionnaireCode = ?2 and t.code =?3 ")
    SurveyQuestionnaireOptions findByRelationCode(String id, String questionId, String optionId);
}
