删除comment

This commit is contained in:
cyk
2023-12-28 22:02:05 +08:00
parent 1508c6d184
commit c9f20864da
4 changed files with 34 additions and 0 deletions

View File

@@ -43,4 +43,6 @@ public interface CommentDao {
*/
List<CommentNode> querySecondCommentList(Integer UrlId);
public String queryChildId(String commentId);
}

View File

@@ -26,4 +26,6 @@ public interface CommentService {
List<CommentNode> queryCommentByUrlId (Integer UrlId );
CommentUser queryCommentUserById(Integer id);
public String SelectChildAndDelete(String commentId);
}

View File

@@ -10,6 +10,7 @@ import com.lovenav.entity.CommentUser;
import com.lovenav.entity.User;
import com.lovenav.service.CommentService;
import io.swagger.models.auth.In;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@@ -169,5 +170,21 @@ public class CommentServiceImpl implements CommentService {
}
return firstList;
}
public String SelectChildAndDelete(String commentId)
{
String child = commentDao.queryChildId(commentId);
String [] childrens = child.split(",");
int flag = 0;
for(String id : childrens)
{
flag = commentDao.deleteByPrimaryKey(Integer.valueOf(id));
if (String.valueOf(flag).equals("0")){
return "出现错误";
}
}
return "处理完成";
}
}