|
|
@@ -15,6 +15,7 @@ import cn.seecoder.seecoderportalserver.web.rest.errors.CustomErrorException;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
@@ -144,8 +145,17 @@ public class CommunicationServiceImpl implements CommunicationService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public PageVO<CommunicationVO> getCommunicationPage(Integer page, Integer size, CommunicationSortStrategyEnum sort) {
|
|
|
- return null;
|
|
|
+ public PageVO<CommunicationVO> getCommunicationPage(Integer page, Integer size, CommunicationSortStrategyEnum sort, Long userId) {
|
|
|
+ List<Sort.Order> orders=new ArrayList<>();
|
|
|
+ if (sort==CommunicationSortStrategyEnum.PUBLISH_TIME_ASC){
|
|
|
+ orders.add(new Sort.Order(Sort.Direction.ASC,"publish_time"));
|
|
|
+ }else {
|
|
|
+ orders.add(new Sort.Order(Sort.Direction.DESC,"publish_time"));
|
|
|
+ }
|
|
|
+ orders.add(new Sort.Order(Sort.Direction.DESC,"deadline"));
|
|
|
+ Pageable pageable = PageRequest.of(page,size,Sort.by(orders));
|
|
|
+ Page<Communication> communicationPage = communicationRepository.findAll(pageable);
|
|
|
+ return toPageVO(communicationPage,userId);
|
|
|
}
|
|
|
|
|
|
@Override
|