Commit e7445cb8 authored by yuwenwen's avatar yuwenwen
parents c168a435 a081df2d
......@@ -5,7 +5,7 @@ VUE_APP_TITLE = 一站式高校轻享平台
ENV = 'development'
# 若依管理系统/开发环境
VUE_APP_BASE_API = 'http://192.168.5.177:8080'
VUE_APP_BASE_API = 'http://127.0.0.1:8080'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
......@@ -66,4 +66,17 @@ public class BbsMomentCommentController extends BaseController {
return toAjax(this.bbsMomentCommentService.removeById(id));
}
/**
* 获取动态评论列表
*/
@ApiOperation("获取动态评论记录详细信息")
@PreAuthorize("@ss.hasPermi('moment:comment:query')")
@GetMapping(value = "/moment/{id}")
public TableDataInfo getMomentComments(@PathVariable("id") Long momentId) {
startPage();
List<BbsMomentComment> list = bbsMomentCommentService.getMomentComments(momentId);
return getDataTable(list);
}
}
......@@ -96,6 +96,9 @@ public class BbsMomentComment extends BaseEntity {
@TableField(exist = false)
private String momentContent;
/** 是否本人评论:0 否、1 是 */
private Integer isSelf;
/**
* 子评论和回复
*/
......
......@@ -30,4 +30,7 @@ public class BbsCommentVO {
/** 评论回复内容 */
private String content;
/** 是否本人评论:0 否、1 是 */
private Integer isSelf;
}
......@@ -22,6 +22,9 @@ public interface BbsMomentCommentMapper extends BaseMapper<BbsMomentComment> {
List<BbsMomentComment> selectBbsMomentComments(@Param("commentId") Long commentId);
List<BbsMomentComment> selectBbsComments(@Param("momentId") Long momentId);
List<BbsMomentComment> selectMomentLimitComments(@Param("momentIds") List<Long> momentIds,
@Param("rows") int rows,
@Param("userName") String userName);
......
......@@ -32,6 +32,15 @@ public interface IBbsMomentCommentService extends IService<BbsMomentComment> {
BbsMomentComment getBbsMomentComment(Long commentId);
/**
* 查询动态评论
*
* @param momentId 动态Id
* @return 投票选项
*/
List<BbsMomentComment> getMomentComments(Long momentId);
/**
* 查询动态评论
*
......
......@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
......@@ -56,6 +57,18 @@ public class BbsMomentCommentServiceImpl extends ServiceImpl<BbsMomentCommentMap
}
/**
* 查询动态评论
*
* @param momentId 动态Id
* @return 投票选项
*/
@Override
public List<BbsMomentComment> getMomentComments(Long momentId) {
return this.baseMapper.selectBbsComments(momentId);
}
/**
* 查询动态评论
*
......@@ -94,8 +107,7 @@ public class BbsMomentCommentServiceImpl extends ServiceImpl<BbsMomentCommentMap
@Override
public void deleteMomentComments(Long momentId) {
this.remove(
Wrappers.lambdaQuery(BbsMomentComment.class)
.eq(BbsMomentComment::getMomentId, momentId)
Wrappers.lambdaQuery(BbsMomentComment.class).eq(BbsMomentComment::getMomentId, momentId)
);
}
......
......@@ -640,6 +640,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
cv.setNickName(c.getNickName());
cv.setUserName(c.getUserName());
cv.setContent(c.getContent());
cv.setIsSelf(c.getIsSelf());
cvs.add(cv);
}
moment.setComments(cvs);
......
......@@ -179,10 +179,10 @@ public class BbsSensitiveWordServiceImpl extends ServiceImpl<BbsSensitiveWordMap
}
// 校验敏感词
Set<String> cacheWords = this.redisCache.getCacheSet(WORD_CACHE_KEY);
Set<String> dbWords = this.getDbWords();
List<BbsSensitiveWord> addWords = new ArrayList<>(readWords.size());
for (String word : readWords) {
if (!cacheWords.contains(word)) {
if (!dbWords.contains(word)) {
BbsSensitiveWord newWord = new BbsSensitiveWord();
newWord.setName(word);
addWords.add(newWord);
......@@ -195,9 +195,6 @@ public class BbsSensitiveWordServiceImpl extends ServiceImpl<BbsSensitiveWordMap
}
super.saveBatch(addWords);
// 缓存敏感词
this.redisCache.setAddValues(WORD_CACHE_KEY, addWords.toArray());
result.setTotalCount(readWords.size());
result.setSuccessCount(addWords.size());
result.setFailCount(readWords.size() - addWords.size());
......
......@@ -45,6 +45,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectBbsComments" resultType="com.tangguo.domain.BbsMomentComment">
SELECT
*
FROM
bbs_moment_comment
WHERE
moment_id = #{momentId}
ORDER BY
create_time
</select>
<select id="selectMomentLimitComments" resultType="com.tangguo.domain.BbsMomentComment">
SELECT c.* FROM (
SELECT
......@@ -56,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.content,
c.parent_id,
c.reply_nick_name,
IF(c.user_name = #{userName}, 1, 0) AS is_self,
ROW_NUMBER() OVER (PARTITION BY moment_id ORDER BY create_time) AS rn
FROM
bbs_moment_comment c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment