|
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
|
18
|
18
|
|
19
|
19
|
import java.time.LocalDateTime;
|
20
|
20
|
import java.util.List;
|
|
21
|
+import java.util.Map;
|
21
|
22
|
|
22
|
23
|
/**
|
23
|
24
|
* <p>
|
|
@@ -97,24 +98,58 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
|
97
|
98
|
page.setCurrent(pageNum);
|
98
|
99
|
page.setSize(pageSize);
|
99
|
100
|
|
100
|
|
- QueryWrapper<Comment> commentQueryWrapper = new QueryWrapper<>();
|
101
|
|
- commentQueryWrapper.eq("comment_type", commentType);
|
102
|
|
- commentQueryWrapper.eq(StringUtils.isNotBlank(mainId),"main_id", mainId);
|
103
|
|
- IPage<Comment> commentIPage = commentMapper.selectPage(page, commentQueryWrapper);
|
|
101
|
+// QueryWrapper<Comment> commentQueryWrapper = new QueryWrapper<>();
|
|
102
|
+// commentQueryWrapper.eq("comment_type", commentType);
|
|
103
|
+// commentQueryWrapper.eq(StringUtils.isNotBlank(mainId),"main_id", mainId);
|
|
104
|
+ IPage<Map<String, Object>> commentIPage = commentMapper.selectCommentListByType(page, commentType);
|
|
105
|
+// .selectPage(page, commentQueryWrapper);
|
104
|
106
|
commentIPage.getRecords().forEach(e -> {
|
105
|
107
|
// 查询图片
|
106
|
108
|
QueryWrapper<CommentImg> queryCommentImgWrapper = new QueryWrapper<>();
|
107
|
|
- queryCommentImgWrapper.eq("comment_id", e.getCommentId());
|
|
109
|
+ queryCommentImgWrapper.eq("comment_id", e.get("comment_id"));
|
108
|
110
|
queryCommentImgWrapper.eq("status", 1);
|
109
|
111
|
queryCommentImgWrapper.orderByAsc("order_no");
|
110
|
112
|
List<CommentImg> commentImgs = commentImgMapper.selectList(queryCommentImgWrapper);
|
111
|
|
- e.setCommentImgList(commentImgs);
|
|
113
|
+ e.put("img", commentImgs);
|
112
|
114
|
});
|
113
|
115
|
|
114
|
116
|
responseBean.addSuccess(commentIPage);
|
115
|
117
|
return responseBean;
|
116
|
118
|
}
|
117
|
119
|
|
|
120
|
+ @Override
|
|
121
|
+ public ResponseBean selectCommentInfoId(String commentId) {
|
|
122
|
+ ResponseBean responseBean = new ResponseBean();
|
|
123
|
+
|
|
124
|
+ Map<String, Object> comment = commentMapper.selectCommentInfoId(commentId);
|
|
125
|
+
|
|
126
|
+ // 查询图片
|
|
127
|
+ QueryWrapper<CommentImg> queryCommentImgWrapper = new QueryWrapper<>();
|
|
128
|
+ queryCommentImgWrapper.eq("comment_id", comment.get("comment_id"));
|
|
129
|
+ queryCommentImgWrapper.eq("status", 1);
|
|
130
|
+ queryCommentImgWrapper.orderByAsc("order_no");
|
|
131
|
+ List<CommentImg> commentImgs = commentImgMapper.selectList(queryCommentImgWrapper);
|
|
132
|
+ comment.put("img", commentImgs);
|
|
133
|
+
|
|
134
|
+ QueryWrapper<Comment> childCommentQuery = new QueryWrapper<>();
|
|
135
|
+ childCommentQuery.eq("parent_id", comment.get("comment_id"));
|
|
136
|
+ childCommentQuery.eq("status", 1);
|
|
137
|
+ List<Comment> childComments = commentMapper.selectList(childCommentQuery);
|
|
138
|
+ childComments.forEach(e -> {
|
|
139
|
+ // 查询图片
|
|
140
|
+ QueryWrapper<CommentImg> queryChildCommentImgWrapper = new QueryWrapper<>();
|
|
141
|
+ queryChildCommentImgWrapper.eq("comment_id", e.getCommentId());
|
|
142
|
+ queryChildCommentImgWrapper.eq("status", 1);
|
|
143
|
+ queryChildCommentImgWrapper.orderByAsc("order_no");
|
|
144
|
+ List<CommentImg> childCommentImgs = commentImgMapper.selectList(queryChildCommentImgWrapper);
|
|
145
|
+ e.setCommentImgList(childCommentImgs);
|
|
146
|
+ });
|
|
147
|
+ comment.put("childComment", childComments);
|
|
148
|
+
|
|
149
|
+ responseBean.addSuccess(comment);
|
|
150
|
+ return responseBean;
|
|
151
|
+ }
|
|
152
|
+
|
118
|
153
|
@Override
|
119
|
154
|
public ResponseBean getWxCommentList(String commentType, String mainId, Integer pageNum, Integer pageSize) {
|
120
|
155
|
ResponseBean responseBean = new ResponseBean();
|
|
@@ -131,6 +166,7 @@ public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> impl
|
131
|
166
|
records.forEach(e -> {
|
132
|
167
|
QueryWrapper<Comment> childCommentQuery = new QueryWrapper<>();
|
133
|
168
|
childCommentQuery.eq("parent_id", e.getCommentId());
|
|
169
|
+ childCommentQuery.eq("status", 1);
|
134
|
170
|
List<Comment> comments = commentMapper.selectList(childCommentQuery);
|
135
|
171
|
e.setChildComment(comments);
|
136
|
172
|
|