Browse Source

更新留言分页- 处理多一层数组问题

wuweihao 3 years ago
parent
commit
7456055245

+ 7 - 3
gis_cms/src/main/java/com/gis/cms/service/impl/CommentServiceImpl.java

@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
@@ -134,17 +135,20 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, CommentEntity
 
         Page<CommentVo> voPage = baseMapper.pageSearch(param, display, iBaseService.initPage(param));
         List<CommentVo> records = voPage.getRecords();
-                Set<Object> filterKey = sensitiveService.getFilterKey();
+
+        Set<Object> filterKey = sensitiveService.getFilterKey();
         CommentTreeUtil commentTreeUtil = new CommentTreeUtil(records, filterKey);
         List<CommentTree> commentTrees = commentTreeUtil.buildTree();
 
         // 转换分页
         Page<Object> resPage = new Page<>();
         BeanUtils.copyProperties(voPage, resPage);
-        resPage.setRecords(Collections.singletonList(commentTrees));
+        ArrayList<Object> list = new ArrayList<>(commentTrees);
+        resPage.setRecords(list);
+
 
+//        resPage.setRecords(Collections.singletonList(commentTrees));
 
-        // todo 2022-08-12
         return Result.success(resPage);
     }