|
|
@@ -171,10 +171,11 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
}
|
|
|
for (BookingComment bookingComment : list){
|
|
|
List<BookingComment> listByParentId = bookingCommentDao.getByParentId(bookingComment.getId());
|
|
|
+ List<BookingComment> bookingCommentList = new ArrayList<>();
|
|
|
for (BookingComment parentComment : listByParentId){
|
|
|
- getComment(parentComment);
|
|
|
+ bookingCommentList.add(getComment(parentComment));
|
|
|
}
|
|
|
- bookingComment.setLowCommentList(listByParentId);
|
|
|
+ bookingComment.setLowCommentList(bookingCommentList);
|
|
|
}
|
|
|
bookCommentDto.setBookingCommentList(list);
|
|
|
return bookCommentDto;
|
|
|
@@ -182,41 +183,39 @@ public class BookingCommentImplService implements BookingCommentService {
|
|
|
public BookingComment getComment(BookingComment parentComment){
|
|
|
if(parentComment!=null){
|
|
|
List<BookingComment> parentCommentList = bookingCommentDao.getByCommentId(parentComment.getId());
|
|
|
+ List<BookingComment> list = new ArrayList<>();
|
|
|
if(parentComment != null && parentCommentList != null){
|
|
|
for(BookingComment low : parentCommentList){//一级评论
|
|
|
- getLowcomment(low);
|
|
|
+ list.add(low);
|
|
|
+ getLowcomment(low,list);
|
|
|
}
|
|
|
+ parentComment.setLowCommentList(list);
|
|
|
}
|
|
|
}
|
|
|
return parentComment;
|
|
|
};
|
|
|
|
|
|
- private void getLowcomment(BookingComment comment){
|
|
|
+// private void getLowcomment(BookingComment comment){
|
|
|
+// List<BookingComment> list = new ArrayList<>();
|
|
|
+// if (comment.getLowCommentList()!=null) {
|
|
|
+// list = comment.getLowCommentList();
|
|
|
+// }
|
|
|
+// List<BookingComment> low = bookingCommentDao.getByCommentId(comment.getId());
|
|
|
+// if(low != null){
|
|
|
+// list.addAll(low);
|
|
|
+// for(BookingComment low1 : list){
|
|
|
+// getLowcomment(low1,comment);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ private void getLowcomment(BookingComment comment,List<BookingComment> parentCommentList){
|
|
|
List<BookingComment> list = new ArrayList<>();
|
|
|
- if (comment.getLowCommentList()!=null) {
|
|
|
- list = comment.getLowCommentList();
|
|
|
- }
|
|
|
- List<BookingComment> low = bookingCommentDao.getByCommentId(comment.getId());
|
|
|
- if(low != null){
|
|
|
- list.addAll(low);
|
|
|
- comment.setLowCommentList(list);
|
|
|
- for(BookingComment low1 : list){
|
|
|
- getLowcomment(low1,comment);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void getLowcomment(BookingComment comment,BookingComment parentCommentList){
|
|
|
- List<BookingComment> list = new ArrayList<>();
|
|
|
- if (parentCommentList.getLowCommentList()!=null) {
|
|
|
- list = parentCommentList.getLowCommentList();
|
|
|
- }
|
|
|
List<BookingComment> low = bookingCommentDao.getByCommentId(comment.getId());
|
|
|
if(low!=null){
|
|
|
- list.addAll(low);
|
|
|
- comment.setLowCommentList(low);
|
|
|
- for(BookingComment low1 : list){
|
|
|
- getLowcomment(low1,comment);
|
|
|
+ for(BookingComment low1 : low){
|
|
|
+ parentCommentList.add(low1);
|
|
|
+ getLowcomment(low1,parentCommentList);
|
|
|
}
|
|
|
}
|
|
|
}
|