|
|
@@ -9,9 +9,10 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
public class TreeRecordsUtil {
|
|
|
/**
|
|
|
- * 根据父类ID获取树形菜单数据
|
|
|
- * @param parentID 父级ID
|
|
|
- * @param lists 数据集合
|
|
|
+ * 锟斤拷锟捷革拷锟斤拷ID锟斤拷取锟斤拷锟轿菜碉拷锟斤拷锟斤拷
|
|
|
+ *
|
|
|
+ * @param parentID 锟斤拷锟斤拷ID
|
|
|
+ * @param lists 锟斤拷锟捷硷拷锟斤拷
|
|
|
* @return
|
|
|
*/
|
|
|
public static List<CommentListVo> queryCommentTreeRecords(String parentID, List<CommentVo> lists) {
|
|
|
@@ -20,14 +21,23 @@ public class TreeRecordsUtil {
|
|
|
List<CommentVo> datas = lists.stream().filter(e -> e.getCommentId().equals(parentID)).collect(Collectors.toList());
|
|
|
|
|
|
for (CommentVo data : datas) {
|
|
|
+ String headPhoto = data.getHeadPhoto();
|
|
|
+ String userName = data.getUserName();
|
|
|
+// 鍟嗗�娌℃湁澶村儚鍜岀敤鎴峰悕
|
|
|
+ if (headPhoto == null) {
|
|
|
+ headPhoto = "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png";
|
|
|
+ }
|
|
|
+ if (userName == null) {
|
|
|
+ userName = "鍟嗗�";
|
|
|
+ }
|
|
|
CommentListVo item = CommentListVo.builder()
|
|
|
.id(data.getId())
|
|
|
.commentId(data.getCommentId())
|
|
|
.commentName(data.getCommentName())
|
|
|
- .userName(data.getUserName())
|
|
|
- .headPhoto(data.getHeadPhoto())
|
|
|
- // 将时间转化为 yyyy/MM/dd
|
|
|
- .dateTime( data.getDateTime().substring(0,19))
|
|
|
+ .userName(userName)
|
|
|
+ .headPhoto(headPhoto)
|
|
|
+ //截取时间,这个时间会多一个0 yyyy/MM/dd
|
|
|
+ .dateTime(data.getDateTime().substring(0, 19))
|
|
|
.content(data.getContent())
|
|
|
.build();
|
|
|
List<CommentListVo> news = queryCommentTreeRecords(item.getId(), lists);
|