Interface ThreadRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<ThreadEntity,Long>, org.springframework.data.jpa.repository.JpaRepository<ThreadEntity,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<ThreadEntity>, org.springframework.data.repository.ListCrudRepository<ThreadEntity,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<ThreadEntity,Long>, org.springframework.data.repository.PagingAndSortingRepository<ThreadEntity,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<ThreadEntity>, org.springframework.data.repository.Repository<ThreadEntity,Long>

public interface ThreadRepository extends org.springframework.data.jpa.repository.JpaRepository<ThreadEntity,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<ThreadEntity>
  • Method Details

    • findByUid

      Optional<ThreadEntity> findByUid(String uid)
    • existsByUid

      Boolean existsByUid(String uid)
    • findFirstByTopicAndOwnerAndDeletedOrderByUpdatedAtDesc

      Optional<ThreadEntity> findFirstByTopicAndOwnerAndDeletedOrderByUpdatedAtDesc(String topic, UserEntity owner, Boolean deleted)
      used for member thread type
    • findByTopicAndDeletedOrderByCreatedAtDesc

      List<ThreadEntity> findByTopicAndDeletedOrderByCreatedAtDesc(String topic, Boolean deleted)
    • findFirstByTopicAndDeletedOrderByCreatedAtDesc

      Optional<ThreadEntity> findFirstByTopicAndDeletedOrderByCreatedAtDesc(String topic, Boolean deleted)
    • findFirstByTopicAndStatusNotContainingAndDeleted

      Optional<ThreadEntity> findFirstByTopicAndStatusNotContainingAndDeleted(String topic, String status, Boolean deleted)
    • findTopicAndStatusesNotInAndDeleted

      @Query(value="select * from core_thread t where t.topic = ?1 and t.status not in ?2 and t.is_deleted = ?3 LIMIT 1", nativeQuery=true) Optional<ThreadEntity> findTopicAndStatusesNotInAndDeleted(String topicWithWildcard, List<String> statuses, Boolean deleted)
    • findByOwnerAndHideAndDeleted

      org.springframework.data.domain.Page<ThreadEntity> findByOwnerAndHideAndDeleted(UserEntity owner, Boolean hide, Boolean deleted, org.springframework.data.domain.Pageable pageable)
    • findFirstByTopic

      List<ThreadEntity> findFirstByTopic(String topic)
    • findByStatusAndDeleted

      List<ThreadEntity> findByStatusAndDeleted(String status, Boolean deleted)
    • findByStatusesAndDeleted

      @Query("SELECT t FROM ThreadEntity t WHERE t.status IN :statuses AND t.deleted = :deleted") List<ThreadEntity> findByStatusesAndDeleted(@Param("statuses") List<String> statuses, Boolean deleted)
    • findByTypesInAndStatusesNotInAndDeleted

      @Query("SELECT t FROM ThreadEntity t WHERE t.type IN :types AND t.status not IN :statuses AND t.deleted = :deleted") List<ThreadEntity> findByTypesInAndStatusesNotInAndDeleted(@Param("types") List<String> types, @Param("statuses") List<String> statuses, Boolean deleted)
    • findByTypesInAndStatusAndDeletedFalse

      @Query("SELECT t FROM ThreadEntity t WHERE t.type IN :types AND t.status = :status AND t.deleted = false") List<ThreadEntity> findByTypesInAndStatusAndDeletedFalse(@Param("types") List<String> types, @Param("status") String status)
    • findByTypesInAndStatusNotAndDeletedFalse

      @Query("SELECT t FROM ThreadEntity t WHERE t.type IN :types AND t.status != :status AND t.deleted = false") List<ThreadEntity> findByTypesInAndStatusNotAndDeletedFalse(@Param("types") List<String> types, @Param("status") String status)
    • countByTopicAndStatusAndDeletedFalse

      @Query("SELECT COUNT(*) FROM ThreadEntity t WHERE t.topic = :topic AND t.status = :status AND t.deleted = false") int countByTopicAndStatusAndDeletedFalse(@Param("topic") String topic, @Param("status") String status)
    • countByTopicAndStatusNotAndDeletedFalse

      @Query("SELECT COUNT(*) FROM ThreadEntity t WHERE t.topic = :topic AND t.status != :status AND t.deleted = false") int countByTopicAndStatusNotAndDeletedFalse(@Param("topic") String topic, @Param("status") String status)
    • findByTopicAndStatusNotAndDeletedFalse

      @Query("SELECT t FROM ThreadEntity t WHERE t.topic = :topic AND t.status != :status AND t.deleted = false") List<ThreadEntity> findByTopicAndStatusNotAndDeletedFalse(@Param("topic") String topic, @Param("status") String status)
    • findByTopicsInAndDeletedFalse

      @Query("SELECT t FROM ThreadEntity t WHERE t.topic IN :topics AND t.deleted = false") List<ThreadEntity> findByTopicsInAndDeletedFalse(@Param("topics") Set<String> topics)
    • findByTopicsInAndDeletedFalse

      @Query("SELECT t FROM ThreadEntity t WHERE t.topic IN :topics AND t.deleted = false") org.springframework.data.domain.Page<ThreadEntity> findByTopicsInAndDeletedFalse(@Param("topics") Set<String> topics, org.springframework.data.domain.Pageable pageable)
    • findByTopicStartsWithAndStatusAndDeletedFalse

      @Query("SELECT t FROM ThreadEntity t WHERE t.topic LIKE :topicPrefix AND t.status = :status AND t.deleted = false ORDER BY t.createdAt ASC") List<ThreadEntity> findByTopicStartsWithAndStatusAndDeletedFalse(@Param("topicPrefix") String topicPrefix, @Param("status") String status)
    • findRecentAgentThreadsByVisitorUid

      @Query(value="SELECT * FROM core_thread t WHERE t.thread_user LIKE %:visitorUid% AND t.thread_type IN (\'AGENT\', \'WORKGROUP\', \'ROBOT\') AND t.is_deleted = false ORDER BY t.updated_at DESC", nativeQuery=true) List<ThreadEntity> findRecentAgentThreadsByVisitorUid(@Param("visitorUid") String visitorUid)
      根据访客ID查找最近的客服会话记录 查找访客与客服的最近一次会话,按更新时间倒序排列