package com.yihu.jw.hospital;


import com.yihu.jw.entity.hospital.DmHospitalDO;
import com.yihu.jw.entity.hospital.team.WlyyAdminTeamDO;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface HospitalDao extends PagingAndSortingRepository<DmHospitalDO, Integer>, JpaSpecificationExecutor<DmHospitalDO> {
    @Query("from DmHospitalDO t where t.town=?1 and t.del='1'")
    List<DmHospitalDO> findByTownCode(String town, Pageable pageRequest);
    @Query("from DmHospitalDO t where t.town=?1 and t.name like ?2 and t.del='1'")
    List<DmHospitalDO> findByTownCodeAndName(String town,String name,Pageable pageRequest);
    @Query("from DmHospitalDO t where t.code=?1 and t.del='1'")
    DmHospitalDO findByCode(String code);

    boolean existsByCode(String code);
}
