效果图
数据库设计
还可以使用路径模块 一级评论id,二级评论id, 用like最左匹配原则查询子评论
因为接手遗留代码,需要添加字段,改动数据库,我就不改动了,导致我下面递归查询子评论不是很好。
业务代码
@Override
public List<SubReviewForm> getSubReviewForms(String publishingId, String creatorId, String sort, String type, String systemType) {
//查询一级评论
SubReviewForm querySubReviewForm = new SubReviewForm();
querySubReviewForm.setSubPublishingParentId(publishingId);
//只看楼主
if (StringUtils.isNotBlank(creatorId)) {
querySubReviewForm.setCreatorId(creatorId);
}
PageUtils