Commit 124093c3 authored by 万成波's avatar 万成波

修复Bug

parent eb362cd1
...@@ -5,7 +5,7 @@ VUE_APP_TITLE = 一站式高校轻享平台 ...@@ -5,7 +5,7 @@ VUE_APP_TITLE = 一站式高校轻享平台
ENV = 'development' 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 VUE_CLI_BABEL_TRANSPILE_MODULES = true
...@@ -66,4 +66,17 @@ public class BbsMomentCommentController extends BaseController { ...@@ -66,4 +66,17 @@ public class BbsMomentCommentController extends BaseController {
return toAjax(this.bbsMomentCommentService.removeById(id)); 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 { ...@@ -96,6 +96,9 @@ public class BbsMomentComment extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String momentContent; private String momentContent;
/** 是否本人评论:0 否、1 是 */
private Integer isSelf;
/** /**
* 子评论和回复 * 子评论和回复
*/ */
......
...@@ -30,4 +30,7 @@ public class BbsCommentVO { ...@@ -30,4 +30,7 @@ public class BbsCommentVO {
/** 评论回复内容 */ /** 评论回复内容 */
private String content; private String content;
/** 是否本人评论:0 否、1 是 */
private Integer isSelf;
} }
...@@ -22,6 +22,9 @@ public interface BbsMomentCommentMapper extends BaseMapper<BbsMomentComment> { ...@@ -22,6 +22,9 @@ public interface BbsMomentCommentMapper extends BaseMapper<BbsMomentComment> {
List<BbsMomentComment> selectBbsMomentComments(@Param("commentId") Long commentId); List<BbsMomentComment> selectBbsMomentComments(@Param("commentId") Long commentId);
List<BbsMomentComment> selectBbsComments(@Param("momentId") Long momentId);
List<BbsMomentComment> selectMomentLimitComments(@Param("momentIds") List<Long> momentIds, List<BbsMomentComment> selectMomentLimitComments(@Param("momentIds") List<Long> momentIds,
@Param("rows") int rows, @Param("rows") int rows,
@Param("userName") String userName); @Param("userName") String userName);
......
...@@ -32,6 +32,15 @@ public interface IBbsMomentCommentService extends IService<BbsMomentComment> { ...@@ -32,6 +32,15 @@ public interface IBbsMomentCommentService extends IService<BbsMomentComment> {
BbsMomentComment getBbsMomentComment(Long commentId); BbsMomentComment getBbsMomentComment(Long commentId);
/**
* 查询动态评论
*
* @param momentId 动态Id
* @return 投票选项
*/
List<BbsMomentComment> getMomentComments(Long momentId);
/** /**
* 查询动态评论 * 查询动态评论
* *
......
...@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; ...@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -56,6 +57,18 @@ public class BbsMomentCommentServiceImpl extends ServiceImpl<BbsMomentCommentMap ...@@ -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 ...@@ -94,8 +107,7 @@ public class BbsMomentCommentServiceImpl extends ServiceImpl<BbsMomentCommentMap
@Override @Override
public void deleteMomentComments(Long momentId) { public void deleteMomentComments(Long momentId) {
this.remove( this.remove(
Wrappers.lambdaQuery(BbsMomentComment.class) Wrappers.lambdaQuery(BbsMomentComment.class).eq(BbsMomentComment::getMomentId, momentId)
.eq(BbsMomentComment::getMomentId, momentId)
); );
} }
......
...@@ -640,6 +640,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment ...@@ -640,6 +640,7 @@ public class BbsMomentServiceImpl extends ServiceImpl<BbsMomentMapper, BbsMoment
cv.setNickName(c.getNickName()); cv.setNickName(c.getNickName());
cv.setUserName(c.getUserName()); cv.setUserName(c.getUserName());
cv.setContent(c.getContent()); cv.setContent(c.getContent());
cv.setIsSelf(c.getIsSelf());
cvs.add(cv); cvs.add(cv);
} }
moment.setComments(cvs); moment.setComments(cvs);
......
...@@ -179,10 +179,10 @@ public class BbsSensitiveWordServiceImpl extends ServiceImpl<BbsSensitiveWordMap ...@@ -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()); List<BbsSensitiveWord> addWords = new ArrayList<>(readWords.size());
for (String word : readWords) { for (String word : readWords) {
if (!cacheWords.contains(word)) { if (!dbWords.contains(word)) {
BbsSensitiveWord newWord = new BbsSensitiveWord(); BbsSensitiveWord newWord = new BbsSensitiveWord();
newWord.setName(word); newWord.setName(word);
addWords.add(newWord); addWords.add(newWord);
...@@ -195,9 +195,6 @@ public class BbsSensitiveWordServiceImpl extends ServiceImpl<BbsSensitiveWordMap ...@@ -195,9 +195,6 @@ public class BbsSensitiveWordServiceImpl extends ServiceImpl<BbsSensitiveWordMap
} }
super.saveBatch(addWords); super.saveBatch(addWords);
// 缓存敏感词
this.redisCache.setAddValues(WORD_CACHE_KEY, addWords.toArray());
result.setTotalCount(readWords.size()); result.setTotalCount(readWords.size());
result.setSuccessCount(addWords.size()); result.setSuccessCount(addWords.size());
result.setFailCount(readWords.size() - addWords.size()); result.setFailCount(readWords.size() - addWords.size());
......
...@@ -45,6 +45,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -45,6 +45,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </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 id="selectMomentLimitComments" resultType="com.tangguo.domain.BbsMomentComment">
SELECT c.* FROM ( SELECT c.* FROM (
SELECT SELECT
...@@ -56,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -56,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.content, c.content,
c.parent_id, c.parent_id,
c.reply_nick_name, 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 ROW_NUMBER() OVER (PARTITION BY moment_id ORDER BY create_time) AS rn
FROM FROM
bbs_moment_comment c 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