Commit 6b252776 authored by 刘基明's avatar 刘基明

评论长度限制

parent 5d339557
...@@ -40,6 +40,9 @@ public class CommentService { ...@@ -40,6 +40,9 @@ public class CommentService {
@Transactional @Transactional
public void insertComment(CommentEntity commentEntity) { public void insertComment(CommentEntity commentEntity) {
commentEntity.setCommentId(uuidGenHelper.getUuidStr()); commentEntity.setCommentId(uuidGenHelper.getUuidStr());
if (commentEntity.getContent().length()>500){
throw new IllegalArgumentException("评论内容超过500字");
}
commentMapper.insert(commentEntity); commentMapper.insert(commentEntity);
//失效缓存 //失效缓存
evictThemeCache(commentEntity.getThemeId()); evictThemeCache(commentEntity.getThemeId());
......
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