package com.ywt.mg.domain.entities;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * create by daiyihua
 */
public interface DoctorTitleRepository extends JpaRepository<DoctorTitle, Integer> {

    /**
     * 得到所有对象
     *
     * @return {@link List<DoctorTitle>}
     */
    @Query(value = "select * from doctor_title where deleted = 0;", nativeQuery = true)
    List<DoctorTitle> findAll();

    /**
     * 得到所有对象
     *
     * @param type 角色：1-医生，2-药师
     * @return {@link List<DoctorTitle>}
     */
    @Query(value = "select * from doctor_title where deleted = 0 and type = ? ;", nativeQuery = true)
    List<DoctorTitle> findAllByType(int type);


}
