接口 CrudService<T,​ID extends java.io.Serializable>

  • 所有已知实现类:
    BaseService

    public interface CrudService<T,​ID extends java.io.Serializable>
    • 方法概要

      所有方法 实例方法 抽象方法 
      修饰符和类型 方法 说明
      long count()
      Returns the number of entities available.
      long count​(org.springframework.data.jpa.domain.Specification<T> spec)
      Returns the number of instances that the given Specification will return.
      void delete​(ID id)
      Deletes the entity with the given id.
      void delete​(ID[] ids)  
      void delete​(ID[] ids, boolean isPhysical)  
      void delete​(ID id, boolean isPhysical)
      Deletes the entity with the given id.
      void delete​(java.lang.Iterable<? extends T> entities)
      Deletes the given entities.
      void delete​(java.lang.Iterable<? extends T> entities, boolean isPhysical)
      Deletes the given entities.
      void delete​(java.util.List<ID> ids)  
      void delete​(java.util.List<ID> ids, boolean isPhysical)  
      void delete​(T entity)
      Deletes a given entity.
      void delete​(T entity, boolean isPhysical)
      Deletes a given entity.
      void deleteAll()
      Deletes all entities managed by the repository.
      void deleteAll​(boolean isPhysical)
      Deletes all entities managed by the repository.
      boolean exists​(ID id)
      Returns whether an entity with the given id exists.
      java.lang.Iterable<T> findAll()
      Returns all instances of the type.
      java.lang.Iterable<T> findAll​(java.lang.Iterable<ID> ids)
      Returns all instances of the type with the given IDs.
      <S extends T>
      java.lang.Iterable<S>
      findAll​(org.springframework.data.domain.Example<S> example)  
      <S extends T>
      org.springframework.data.domain.Page<S>
      findAll​(org.springframework.data.domain.Example<S> example, org.springframework.data.domain.Pageable pageable)  
      java.util.List<T> findAll​(org.springframework.data.jpa.domain.Specification<T> spec)
      Returns all entities matching the given Specification.
      org.springframework.data.domain.Page<T> findAll​(org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Pageable pageable)
      Returns a Page of entities matching the given Specification.
      java.util.List<T> findAll​(org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Sort sort)
      Returns all entities matching the given Specification and Sort.
      java.util.List<T> findAll​(T entity)  
      java.util.List<T> findAll​(T entity, org.springframework.data.domain.ExampleMatcher matcher)  
      org.springframework.data.domain.Page<T> findAll​(T entity, org.springframework.data.domain.ExampleMatcher matcher, org.springframework.data.domain.Pageable pageable)  
      org.springframework.data.domain.Page<T> findAll​(T entity, org.springframework.data.domain.Pageable pageable)  
      T findOne​(ID id)
      Retrieves an entity by its id.
      T findOne​(org.springframework.data.jpa.domain.Specification<T> spec)
      Returns a single entity matching the given Specification.
      T getOne​(ID id)
      Returns a reference to the entity with the given identifier.
      org.springframework.data.jpa.domain.Specification<T> handleQueryAnnotation​(T entity)  
      org.springframework.data.jpa.domain.Specification<T> handleQueryAnnotation​(T entity, org.springframework.data.domain.ExampleMatcher matcher)  
      <S extends T>
      java.lang.Iterable<S>
      save​(java.lang.Iterable<S> entities)
      Saves all given entities.
      <S extends T>
      S
      save​(S entity)
      Saves a given entity.
      T update​(ID id, T entity)
      fetch an entity
    • 方法详细资料

      • save

        <S extends T> S save​(S entity)
        Saves a given entity. Use the returned instance for further operations as the save operation might have changed the entity instance completely.
        类型参数:
        S - S
        参数:
        entity - Jpa Entity
        返回:
        the saved entity
      • save

        <S extends T> java.lang.Iterable<S> save​(java.lang.Iterable<S> entities)
        Saves all given entities.
        类型参数:
        S - S
        参数:
        entities - The entities
        返回:
        the saved entities
        抛出:
        java.lang.IllegalArgumentException - in case the given entity is null.
      • findOne

        T findOne​(ID id)
        Retrieves an entity by its id.
        参数:
        id - must not be null.
        返回:
        the entity with the given id or null if none found
        抛出:
        java.lang.IllegalArgumentException - if id is null
      • getOne

        T getOne​(ID id)
        Returns a reference to the entity with the given identifier.
        参数:
        id - must not be null.
        返回:
        a reference to the entity with the given identifier.
        另请参阅:
        EntityManager.getReference(Class, Object)
      • exists

        boolean exists​(ID id)
        Returns whether an entity with the given id exists.
        参数:
        id - must not be null.
        返回:
        true if an entity with the given id exists, false otherwise
        抛出:
        java.lang.IllegalArgumentException - if id is null
      • findAll

        java.lang.Iterable<T> findAll()
        Returns all instances of the type.
        返回:
        all entities
      • findAll

        java.lang.Iterable<T> findAll​(java.lang.Iterable<ID> ids)
        Returns all instances of the type with the given IDs.
        参数:
        ids - ids
        返回:
        I
      • count

        long count()
        Returns the number of entities available.
        返回:
        the number of entities
      • delete

        void delete​(ID id)
        Deletes the entity with the given id.
        参数:
        id - must not be null.
        抛出:
        java.lang.IllegalArgumentException - in case the given id is null
      • delete

        void delete​(java.util.List<ID> ids)
      • delete

        void delete​(ID[] ids)
      • delete

        void delete​(T entity)
        Deletes a given entity.
        参数:
        entity - The entity
        抛出:
        java.lang.IllegalArgumentException - in case the given entity is null.
      • delete

        void delete​(java.lang.Iterable<? extends T> entities)
        Deletes the given entities.
        参数:
        entities - The entities
        抛出:
        java.lang.IllegalArgumentException - in case the given Iterable is null.
      • deleteAll

        void deleteAll()
        Deletes all entities managed by the repository.
      • findAll

        <S extends T> java.lang.Iterable<S> findAll​(org.springframework.data.domain.Example<S> example)
      • findAll

        <S extends T> org.springframework.data.domain.Page<S> findAll​(org.springframework.data.domain.Example<S> example,
                                                                      org.springframework.data.domain.Pageable pageable)
      • delete

        void delete​(ID id,
                    boolean isPhysical)
        Deletes the entity with the given id.
        参数:
        id - must not be null.
        isPhysical - default 'false' when the entity is reparable and give 'true' for need deleted by physical. Otherwise it will no use, same as delete(T)
        抛出:
        java.lang.IllegalArgumentException - in case the given id is null
      • delete

        void delete​(java.util.List<ID> ids,
                    boolean isPhysical)
      • delete

        void delete​(ID[] ids,
                    boolean isPhysical)
      • delete

        void delete​(T entity,
                    boolean isPhysical)
        Deletes a given entity.
        参数:
        entity - entity
        isPhysical - py
        抛出:
        java.lang.IllegalArgumentException - in case the given entity is null.
      • delete

        void delete​(java.lang.Iterable<? extends T> entities,
                    boolean isPhysical)
        Deletes the given entities.
        参数:
        entities - entities
        isPhysical - py
        抛出:
        java.lang.IllegalArgumentException - in case the given Iterable is null.
      • deleteAll

        void deleteAll​(boolean isPhysical)
        Deletes all entities managed by the repository.
        参数:
        isPhysical - py
      • update

        T update​(ID id,
                 T entity)
        fetch an entity
        参数:
        id - id
        entity - en
        返回:
        T
      • findOne

        T findOne​(org.springframework.data.jpa.domain.Specification<T> spec)
        Returns a single entity matching the given Specification.
        参数:
        spec - spec
        返回:
        T
      • findAll

        java.util.List<T> findAll​(org.springframework.data.jpa.domain.Specification<T> spec)
        Returns all entities matching the given Specification.
        参数:
        spec - spec
        返回:
        List T
      • findAll

        org.springframework.data.domain.Page<T> findAll​(org.springframework.data.jpa.domain.Specification<T> spec,
                                                        org.springframework.data.domain.Pageable pageable)
        Returns a Page of entities matching the given Specification.
        参数:
        spec - spec
        pageable - page
        返回:
        Page T
      • findAll

        java.util.List<T> findAll​(org.springframework.data.jpa.domain.Specification<T> spec,
                                  org.springframework.data.domain.Sort sort)
        Returns all entities matching the given Specification and Sort.
        参数:
        spec - spec
        sort - sort
        返回:
        List T
      • count

        long count​(org.springframework.data.jpa.domain.Specification<T> spec)
        Returns the number of instances that the given Specification will return.
        参数:
        spec - the Specification to count instances for
        返回:
        the number of instances
      • findAll

        java.util.List<T> findAll​(T entity)
      • findAll

        org.springframework.data.domain.Page<T> findAll​(T entity,
                                                        org.springframework.data.domain.Pageable pageable)
      • findAll

        java.util.List<T> findAll​(T entity,
                                  org.springframework.data.domain.ExampleMatcher matcher)
      • findAll

        org.springframework.data.domain.Page<T> findAll​(T entity,
                                                        org.springframework.data.domain.ExampleMatcher matcher,
                                                        org.springframework.data.domain.Pageable pageable)
      • handleQueryAnnotation

        org.springframework.data.jpa.domain.Specification<T> handleQueryAnnotation​(T entity)
      • handleQueryAnnotation

        org.springframework.data.jpa.domain.Specification<T> handleQueryAnnotation​(T entity,
                                                                                   org.springframework.data.domain.ExampleMatcher matcher)