feat: 开发中...
This commit is contained in:
@@ -50,7 +50,7 @@ public class BlogController {
|
||||
|
||||
@DeleteMapping("/{blogID}/")
|
||||
@Operation(summary = "删除博文")
|
||||
public ResponseVO<Void> removeBlog(@PathVariable Long blogID) {
|
||||
return blogService.removeBlog(blogID);
|
||||
public ResponseVO<Void> deleteBlog(@PathVariable Long blogID) {
|
||||
return blogService.deleteBlog(blogID);
|
||||
}
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ public class AttachEntity {
|
||||
|
||||
@CreatedDate
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "create_time", nullable = false)
|
||||
@Column(name = "create_time", nullable = false, updatable = false)
|
||||
private Date createTime;
|
||||
|
||||
@LastModifiedDate
|
||||
|
@@ -54,7 +54,7 @@ public class BlogAttachEntity {
|
||||
|
||||
@CreatedDate
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "create_time", nullable = false)
|
||||
@Column(name = "create_time", nullable = false, updatable = false)
|
||||
private Date createTime;
|
||||
|
||||
@LastModifiedDate
|
||||
|
@@ -74,7 +74,7 @@ public class BlogEntity {
|
||||
|
||||
@CreatedDate
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "create_time", nullable = false)
|
||||
@Column(name = "create_time", nullable = false, updatable = false)
|
||||
private Date createTime;
|
||||
|
||||
@LastModifiedDate
|
||||
|
@@ -33,7 +33,7 @@ public class SettingEntity {
|
||||
|
||||
@CreatedDate
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "create_time", nullable = false)
|
||||
@Column(name = "create_time", nullable = false, updatable = false)
|
||||
private Date createTime;
|
||||
|
||||
@LastModifiedDate
|
||||
|
@@ -63,7 +63,7 @@ public class UserEntity {
|
||||
|
||||
@CreatedDate
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "create_time", nullable = false)
|
||||
@Column(name = "create_time", nullable = false, updatable = false)
|
||||
private Date createTime;
|
||||
|
||||
@LastModifiedDate
|
||||
|
@@ -16,5 +16,5 @@ public interface IBlogService {
|
||||
|
||||
@NotNull ResponseVO<Void> updateBlog(@NotNull Long blogID, @NotNull BlogUpdateRequireVO requireVO);
|
||||
|
||||
@NotNull ResponseVO<Void> removeBlog(@NotNull Long blogID);
|
||||
@NotNull ResponseVO<Void> deleteBlog(@NotNull Long blogID);
|
||||
}
|
||||
|
@@ -30,7 +30,6 @@ public class BlogService implements IBlogService {
|
||||
if (checked != null) {
|
||||
return checked;
|
||||
}
|
||||
log.info("create blog vo: {}", requireVO);
|
||||
BlogEntity entity = blogMapper.voToEntity(requireVO);
|
||||
entity = blogRepo.save(entity);
|
||||
return ResponseVO.success(entity.getId());
|
||||
@@ -54,7 +53,7 @@ public class BlogService implements IBlogService {
|
||||
if (user == null) {
|
||||
return ResponseVO.unauthorized();
|
||||
}
|
||||
log.info("update blog vo: {}", requireVO);
|
||||
log.info("update blog vo: {}", blogID);
|
||||
BlogEntity blogEntity = blogRepo.findByIdWithCreator(blogID);
|
||||
if (blogEntity == null) {
|
||||
return ResponseVO.failed("该博文不存在!");
|
||||
@@ -78,11 +77,12 @@ public class BlogService implements IBlogService {
|
||||
blogEntity.setPublish(requireVO.getPublish());
|
||||
blogEntity.setTags(requireVO.getTags());
|
||||
blogRepo.save(blogEntity);
|
||||
|
||||
return ResponseVO.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ResponseVO<Void> removeBlog(@NotNull Long blogID) {
|
||||
public @NotNull ResponseVO<Void> deleteBlog(@NotNull Long blogID) {
|
||||
BlogUser user = BlogUtils.getCurrentUser().orElse(null);
|
||||
if (user == null) {
|
||||
return ResponseVO.unauthorized();
|
||||
|
Reference in New Issue
Block a user