Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Fix: comment id auto increase
Browse files Browse the repository at this point in the history
  • Loading branch information
lyujp committed Jul 19, 2024
1 parent 4618cd7 commit 8c88127
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public ResponseDto<Object> deny(@PathVariable Long id) {
if (status) {
return ResponseDto.success();
} else {
return ResponseDto.error(-1, "Comment pass failed");
return ResponseDto.error(-1, "Comment deny failed");
}
}
}
3 changes: 3 additions & 0 deletions src/main/java/cn/luijp/escserver/model/entity/Comment.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package cn.luijp.escserver.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class Comment {

@TableId(type = IdType.AUTO)
private Long id;

private Long postId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public CommentListDto getComment(Long postId, Integer pageNum, Integer pageSize,

public Boolean passComment(Long id) {
LambdaUpdateWrapper<Comment> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(Comment::getId, id).set(Comment::getVisible, true);
updateWrapper.eq(Comment::getId, id).set(Comment::getVisible, 1);
return commentService.update(updateWrapper);
}

public Boolean denyComment(Long id) {
LambdaUpdateWrapper<Comment> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(Comment::getId, id).set(Comment::getVisible, false);
updateWrapper.eq(Comment::getId, id).set(Comment::getVisible, 0);
return commentService.update(updateWrapper);
}
}

0 comments on commit 8c88127

Please sign in to comment.