Java 在mongo自定义存储库中实现可分页
我的mongodb存储库如下所示:Java 在mongo自定义存储库中实现可分页,java,mongodb,pagination,spring-data,spring-data-mongodb,Java,Mongodb,Pagination,Spring Data,Spring Data Mongodb,我的mongodb存储库如下所示: public interface ErrorLogRepository extends MongoRepository<ErrorLog, String>, ErrorLogRepositoryCustom{ } public interface ErrorLogRepositoryCustom extends MongoRepository<ErrorLog, String>,
public interface ErrorLogRepository
extends MongoRepository<ErrorLog, String>,
ErrorLogRepositoryCustom{
}
public interface ErrorLogRepositoryCustom
extends MongoRepository<ErrorLog, String>,
ErrorLogRepositoryCustom{
// public List<ErrorLog> filterLogs(Date date, String type);
}
public class ErrorLogRepositoryImpl
implements ErrorLogRepositoryCustom {
@Override
public List<ErrorLog> filterLogs(Date date, String type){
//do some processing and return a list
}
}
公共接口错误日志存储库
扩展了Mongorespository,
ErrorLogRepositoryCustom{
}
公共接口错误LogRepositoryCustom
扩展了Mongorespository,
ErrorLogRepositoryCustom{
//公共列表过滤器日志(日期,字符串类型);
}
公共类ErrorLogRepositoryImpl
实现ErrorLogRepositoryCustom{
@凌驾
公共列表筛选器日志(日期,字符串类型){
//进行一些处理并返回一个列表
}
}
我有一些特殊的逻辑需要实现。所以我必须创建CustomRepository。
如何在自定义repo中实现filterLogs()的分页