package com.uas.console.donate.dao; import com.uas.console.donate.model.Org; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface OrgDao extends JpaRepository,JpaSpecificationExecutor,PagingAndSortingRepository { //取出某状态下的所有已正式发布机构 @Query("from Org o where o.status=:status and publish=2") List findByStatus(@Param("status")Integer status); //根据机构类型和状态查询已发布机构 @Query("from Org o where type=:type and status=:status and publish=2 order By createTime desc") List findByType(@Param("type") Integer type,@Param("status")Integer status); //根据机构主要领域和状态查询已发布机构 @Query("from Org o where majorArea=:majorArea and status=:status and publish=2 order By createTime desc") List findByMajorArea(@Param("majorArea") Integer majorArea,@Param("status")Integer status); //根据机构类别,主要领域,状态查询已发布机构 @Query("from Org o where type=:type and majorArea=:majorArea and status=:status and publish=2 order By createTime desc" ) List findByTypeAndMajorArea(@Param("type") Integer type,@Param("majorArea")Integer majorArea,@Param("status")Integer status); //根据UUID取出唯一的机构信息 @Query("from Org o where uuid=:uuid") Org findOne(@Param("uuid") Long uuid); Page findAll(Pageable pageable); //根据搜索框查询机构信息 @Query("from Org o where o.name like %:search%") List search(@Param("search") String search); }