This commit is contained in:
2026-04-30 16:27:58 +08:00
parent ac6442a452
commit 2adefb5207
16 changed files with 284 additions and 349 deletions
@@ -2,6 +2,8 @@ package com.yaoyuan.jiscuss.common;
import com.yaoyuan.jiscuss.entity.custom.PostCustom;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.Date;
@@ -17,6 +19,8 @@ import java.util.List;
@Data
public class Node {
private static final Logger logger = LoggerFactory.getLogger(Node.class);
/**
* Node
* 空方法
@@ -85,7 +89,7 @@ public class Node {
for (Node node1 : list) { //循环添加
if (node1.getId().equals(node.getParentId())) { //判断留言的上一段是都是这条留言
node1.getNextNodes().add(node); //是,添加,返回true;
System.out.println("添加了一个");
logger.debug("添加了一个");
return true;
} else { //否则递归继续判断
if (node1.getNextNodes().size() != 0) {
@@ -127,7 +131,7 @@ public class Node {
**/
public static void show(List<Node> list) {
for (Node node : list) {
System.out.println(node.getUserId() + " 用户回复了你:" + node.getContent());
logger.debug("{} 用户回复了你:{}", node.getUserId(), node.getContent());
if (node.getNextNodes().size() != 0) {
Node.show(node.getNextNodes());
}