package com.yihu.wlyy.repository; import com.yihu.wlyy.entity.doctor.profile.Doctor; import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam; import com.yihu.wlyy.entity.doctor.team.admin.AdminTeamMember; 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 org.springframework.data.repository.query.Param; import java.util.List; /** * 行政团队成员DAO。 * * @author Sand */ public interface DrAdminTeamMemberDao extends PagingAndSortingRepository, JpaSpecificationExecutor { AdminTeamMember findByTeamIdAndDoctorCodeOrderByDoctorCodeAsc(long teamId, String doctorCode); @Query("SELECT t FROM AdminTeamMember m, AdminTeam t WHERE m.doctorCode = :doctorCode AND t.id = m.teamId") List findDoctorTeams(@Param(value = "doctorCode") String doctorCode); @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m" + ".teamId AND m.doctorCode = d.code") List findTeamMembers(@Param(value = "teamId") long teamId); @Query("SELECT 1 FROM AdminTeamMember WHERE teamId = :teamId AND doctorCode = :doctorCode") Integer isMemberExist(@Param(value = "teamId") long teamId, @Param(value = "doctorCode") String doctorCode); }