| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 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<Org,Long>,JpaSpecificationExecutor<Org>,PagingAndSortingRepository<Org, Long> {
- //取出某状态下的所有已正式发布机构
- @Query("from Org o where o.status=:status and publish=2")
- List<Org> findByStatus(@Param("status")Integer status);
- //根据机构类型和状态查询已发布机构
- @Query("from Org o where type=:type and status=:status and publish=2 order By createTime desc")
- List<Org> 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<Org> 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<Org> 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<Org> findAll(Pageable pageable);
- //根据搜索框查询机构信息
- @Query("from Org o where o.name like %:search%")
- List<Org> search(@Param("search") String search);
- }
|