mirror of https://github.com/halo-dev/halo
Add BaseRepository
parent
d0167dcc64
commit
c215e40a91
|
@ -0,0 +1,37 @@
|
|||
package cc.ryanc.halo.repository.base;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.repository.NoRepositoryBean;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Base repository interface contains some common methods.
|
||||
*
|
||||
* @param <DOMAIN> doamin type
|
||||
* @param <ID> id type
|
||||
* @author johnniang
|
||||
*/
|
||||
@NoRepositoryBean
|
||||
public interface BaseRepository<DOMAIN, ID> extends JpaRepository<DOMAIN, ID> {
|
||||
|
||||
/**
|
||||
* Finds all domain by id list and the specified sort.
|
||||
*
|
||||
* @param ids id list of domain must not be null
|
||||
* @param sort the specified sort must not be null
|
||||
* @return a list of domains
|
||||
*/
|
||||
@NonNull
|
||||
List<DOMAIN> findAllByIdIn(@NonNull Iterable<ID> ids, @NonNull Sort sort);
|
||||
|
||||
/**
|
||||
* Deletes by id list.
|
||||
*
|
||||
* @param ids id list of domain must not be null
|
||||
* @return number of rows affected
|
||||
*/
|
||||
long deleteByIdIn(@NonNull Iterable<ID> ids);
|
||||
}
|
Loading…
Reference in New Issue