|
|
@@ -573,7 +573,7 @@ public class TechnicianMomentServiceImpl extends ServiceImpl<TechnicianMomentMap
|
|
|
* @return List<MomentListVO> 草稿列表
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<MomentListVO> getDraftMoments(String openId, Integer pageNum, Integer pageSize) {
|
|
|
+ public Page<MomentListVO> getDraftMoments(String openId, Integer pageNum, Integer pageSize) {
|
|
|
if (openId == null || openId.trim().isEmpty()) {
|
|
|
throw new ServiceException("openId不能为空");
|
|
|
}
|
|
|
@@ -596,12 +596,14 @@ public class TechnicianMomentServiceImpl extends ServiceImpl<TechnicianMomentMap
|
|
|
|
|
|
Page<TechnicianMoment> momentPage = momentMapper.selectPage(page, momentWrapper);
|
|
|
List<TechnicianMoment> moments = momentPage.getRecords();
|
|
|
+ Page<MomentListVO> voPage = new Page<>(pageNum, pageSize);
|
|
|
if (moments == null || moments.isEmpty()) {
|
|
|
- return new ArrayList<>();
|
|
|
+ // 草稿列表为空时,返回空Page对象
|
|
|
+ return voPage;
|
|
|
}
|
|
|
|
|
|
// 3. 组装VO
|
|
|
- return moments.stream().map(moment -> {
|
|
|
+ List<MomentListVO> collect = moments.stream().map(moment -> {
|
|
|
MomentListVO vo = new MomentListVO();
|
|
|
BeanUtils.copyProperties(moment, vo);
|
|
|
vo.setTechnicianNickName(technician.getcNickName());
|
|
|
@@ -611,6 +613,11 @@ public class TechnicianMomentServiceImpl extends ServiceImpl<TechnicianMomentMap
|
|
|
vo.setPublishTime(moment.getCreateTime());
|
|
|
return vo;
|
|
|
}).collect(Collectors.toList());
|
|
|
+ //返回Page对象
|
|
|
+
|
|
|
+ voPage.setTotal(momentPage.getTotal());
|
|
|
+ voPage.setRecords(collect);
|
|
|
+ return voPage;
|
|
|
}
|
|
|
|
|
|
/**
|