|
@@ -1,14 +1,18 @@
|
|
|
package cn.efunbox.audio.impl;
|
|
|
|
|
|
import cn.efunbox.audio.entity.Audio;
|
|
|
+import cn.efunbox.audio.entity.Grouping;
|
|
|
import cn.efunbox.audio.entity.Record;
|
|
|
import cn.efunbox.audio.repository.AudioRepo;
|
|
|
import cn.efunbox.audio.repository.RecordRepo;
|
|
|
import cn.efunbox.audio.service.AudioService;
|
|
|
import cn.efunbox.audio.service.RecordService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -21,8 +25,13 @@ public class RecordServiceImpl implements RecordService {
|
|
|
RecordRepo recordRepo;
|
|
|
|
|
|
@Override
|
|
|
- public List<Record> SearchAll(){
|
|
|
- List<Record> list = recordRepo.findAll();
|
|
|
+ public List<Record> SearchAll(int page, int size){
|
|
|
+ List<Record> list = new ArrayList<>();
|
|
|
+ if(size > 0){
|
|
|
+ Pageable pageable = new PageRequest(page, size);
|
|
|
+ list = recordRepo.findAll(pageable).getContent();
|
|
|
+ }else
|
|
|
+ list = recordRepo.findAll();
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@@ -33,20 +42,29 @@ public class RecordServiceImpl implements RecordService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Record> SearchByIdChannel(Long id){
|
|
|
- List<Record> list = recordRepo.findByIdChannel(id);
|
|
|
+ public List<Record> SearchByIdChannel(Long id, int page, int size){
|
|
|
+ if(size<=0)
|
|
|
+ size = 100;
|
|
|
+ Pageable pageable = new PageRequest(page, size);
|
|
|
+ List<Record> list = recordRepo.findByIdChannel(id, pageable);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Record> SearchByIdDevice(Long id){
|
|
|
- List<Record> list = recordRepo.findByIdDevice(id);
|
|
|
+ public List<Record> SearchByIdDevice(Long id, int page, int size){
|
|
|
+ if(size<=0)
|
|
|
+ size = 100;
|
|
|
+ Pageable pageable = new PageRequest(page, size);
|
|
|
+ List<Record> list = recordRepo.findByIdDevice(id, pageable);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Record> SearchByIdAudio(Long id){
|
|
|
- List<Record> list = recordRepo.findByIdAudio(id);
|
|
|
+ public List<Record> SearchByIdAudio(Long id, int page, int size){
|
|
|
+ if(size<=0)
|
|
|
+ size = 100;
|
|
|
+ Pageable pageable = new PageRequest(page, size);
|
|
|
+ List<Record> list = recordRepo.findByIdAudio(id, pageable);
|
|
|
return list;
|
|
|
}
|
|
|
|