DrAdminTeamMemberDao.java 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. package com.yihu.wlyy.repository;
  2. import com.yihu.wlyy.entity.doctor.profile.Doctor;
  3. import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
  4. import com.yihu.wlyy.entity.doctor.team.admin.AdminTeamMember;
  5. import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  6. import org.springframework.data.jpa.repository.Modifying;
  7. import org.springframework.data.jpa.repository.Query;
  8. import org.springframework.data.repository.PagingAndSortingRepository;
  9. import org.springframework.data.repository.query.Param;
  10. import java.util.List;
  11. /**
  12. * 行政团队成员DAO。
  13. *
  14. * @author Sand
  15. */
  16. public interface DrAdminTeamMemberDao extends
  17. PagingAndSortingRepository<AdminTeamMember, Long>,
  18. JpaSpecificationExecutor<AdminTeamMember> {
  19. AdminTeamMember findByTeamIdAndDoctorCodeOrderByDoctorCodeAsc(long teamId, String doctorCode);
  20. @Query("SELECT t FROM AdminTeamMember m, AdminTeam t WHERE m.doctorCode = :doctorCode AND t.id = m.teamId")
  21. List<AdminTeam> findDoctorTeams(@Param(value = "doctorCode") String doctorCode);
  22. @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m" +
  23. ".teamId AND m.doctorCode = d.code")
  24. List<Doctor> findTeamMembers(@Param(value = "teamId") long teamId);
  25. @Query("SELECT 1 FROM AdminTeamMember WHERE teamId = :teamId AND doctorCode = :doctorCode")
  26. Integer isMemberExist(@Param(value = "teamId") long teamId, @Param(value = "doctorCode") String doctorCode);
  27. }